Support custom locator to locate element
See original GitHub issueIs your feature request related to a problem? Please describe. Support custom locator to locate element
Describe the solution you’d like In SeleniumLibrary, we can use the keyword “Add locator strategy” to register a custom locator approach using a custom keyword that returns a WebElement.
Then we can use it like Click Element | custom:example
Please support this feature, since this one is crucial & widely used.
Thank you so much!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Selenium WebDriver: Custom Locators - LinkedIn
You can create custom locators to hide the complexities and make it easy to locate the elements with visible text or partially visible...
Read more >Locators In Selenium WebDriver With Examples - LambdaTest
Selenium WebDriver provides the findElement() and findElements() method to locate the WebElements using the appropriate web locator.
Read more >What are Selenium Locators?How to use them to find web ...
Locators are the way to identify an HTML element on a web page, and almost all UI automation tools provide the capability to...
Read more >Custom Locators in Selenium - CherCher Tech
This way we can find an element with a custom attribute, Before we can create a custom locator let's understand the By class...
Read more >Locators in Selenium- How To Locate Elements On Web-page?
The most popular way to identify web element is to use Id. Id's are considered as the safest and fastest locator option and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In my project, I’m using custom locator to locate every element rather than using CSS class or element id… I’m using their labels to determine which element is being pointed to.
For example, the page currently is having some textboxes:
Customer Name: [____________________]
Customer Address: [____________________]
Then I will write a custom locator named “item” to locate the corresponding textboxes using their own labels:
Click Element | item:Customer Name
Click Element | item:Customer Address
This approach works pretty well in many cases & reduce effort for inspecting elements to find their HTML attributes. Moreover, I can also verify their labels to check whether they are correct or not.SeleniumLibrary supports it. I hope you guys can also support it.
This is possible with js extensions: see “Example module keyword for custom selector registering” from https://marketsquare.github.io/robotframework-browser/Browser.html