-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyword that checks focus #851
Comments
That was closed because of inactivity in the issue, which usually means that need for the request has ended. Could you describe your need or requirements why you want to check a focus? Also could you describe what a focus means in your case? |
Thanks for the reply I test div modals for w3c compliance (accessibility testing), and one of the many requirements is to verify visual/operational focus on forms is placed on the first available user modifiable element within the form. When an element gains visual and operational focus (usually they go hand in hand), the user should be able to begin typing immediately for text fields, use up or down arrows for drop-down menus, or press the space bar for check boxes/radio buttons. |
Sorry for the long delay but I am holidays and I have limited access to the internet. I am unfamiliar with the topic, but I generally understand the topic. As far I recall the selenium API, the are not any direct support for this in the selenium API. Is the focus generally visible somehow in the DOM or how does it work? |
No worries at all. I just got back from a vacation myself. If you reference this stack overflow help topic, you'll see that selenium webdriver has a solution for this. I'm aware that robot framework utilizes selenium2library, but there is a solution in the selenium world. Essentially, this function will return a boolean value if the expected element focused is the actual element focused: |
I see your point. I think this would be good addition to the library. Few things to consider, from implementation point of view:
Would you be willing to submit a PR? If you are remember to write tests too? |
Keyword should not returning a boolean (True/False) value. Instead keyword should fail (raise an error/exception) if the element does not have a focus and keyword should pass if the element has a focus. PR is a pull request, it's a way to contribute code to the github repository. More details in here: https://help.github.com/articles/about-pull-requests/ |
And creating PR explained in here: https://help.github.com/articles/creating-a-pull-request/ |
Creating a pull request would imply that I am contributing code. I do not have code to contribute. I was under the impression that I could request a change, and that a contributor could code the solution. I do not have sufficient understanding of robot framework to code this solution. |
Thanks @WinterSoldier55 |
@HelioGuilherme66, thank you very much! |
Yes, me requesting a PR from you, means that you would also provide the code. But it's not mandatory, submitting issues and providing ideas how to enhance the library is great too. If you don't want to provide the implementation, then it waits for someone else to provide the implementation. Currently I am focused to fix the final things for the next release [1] and I not taking anything else for development in the near future. Then the other option is you to find someone else to provide the implementation. You can either try find someone, who is facing the same problem and ask him to provide the implementation or you can pay someone to provide the implementation. But if you know basics of Python and selenium then making the implementation should be relatively easy. The Robot Framework library API is explained in the user guide[2] and there are plenty of keywords where you can take an examples. The Selenium2Library uses the the dynamic library API[3], but it's invisible when creating new keywords (only thing which is needed, is to use [1] https://github.com/robotframework/Selenium2Library/milestone/17 |
@HelioGuilherme66 Selenium documentation shows an example how to compare elements: http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webelement.WebElement.id |
@WinterSoldier55 please take a look #855 and is it what you expected. |
@aaltat, the code seems to work as expected! |
Somehow "Should Have Focus" would sound better to me than "Should Be Focused". Probably better to ask an opinion from some native English speaker, though. Is there also a negative version of the kw like "Should Not Have Focus"? |
The current keyword name is There is not negative version. |
New keyword `Should Be Focused`. See issue #851.
Done is #855 |
This was reported and closed on :
Adding a keyword such as
Element Should be focused
would be very useful.Is there a way to check this currently in RobotFramework?
Thank you for your time
The text was updated successfully, but these errors were encountered: