How do Selenium tests locate elements for manipulation?
-
Several websites go over it, but it's actually really hard to locate each one - I've heard locating by id is best practice. If you could help me figure it out how to use FireBug/Inspect element to pinpoint a technique it would be very helpful. See if you can answer this too: http://stackoverflow.com/questions/16493992/how-to-locate-search-links-in-google-in-selenium-for-testing
-
Answer:
you may not even need firebug(though its certainly very helpful) .In whatever browser you use, right click on the element of your interest and click inspect element .That will show you where in the source code the element is located, from there you can use an use its id or use xpath, basically any thing which uniquely indentifies that element.
Kayomars at Quora Visit the source
Other answers
Firebug is a firefox plug-in help you to point out the required HTML element which you want to validate in your web automation. You can get the element attributes like class, name, etc. As you said locate element by id is best practice. you can use xpath by adding fire path plug-in for verifying dynamic html elements.
Rakesh Tirumala
Related Q & A:
- How To Locate Landline Number?Best solution by Yahoo! Answers
- How do you search DOM elements using CSS selectors in Chrome?Best solution by Stack Overflow
- How to handle a popup in selenium webdriver?Best solution by Stack Overflow
- How do I locate a Yahoo member?Best solution by Yahoo! Answers
- How many types of manipulation are there?Best solution by en.wikipedia.org
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.