Reputation: 129
I am just starting to learn Selenium WebDriver
. I would like to find This checkbox and click. I can't get it on the straight because it is hidden. Should I get all checkboxes and after it get necessary field?
My code
HTML
Upvotes: 2
Views: 133
Reputation: 6398
try using XPATH as follows, to find the element highlighted in underline in the image attached in the question:
By.Xpath("//label[@for='bodystyle-5']")
note: By.name
can be used ONLY for name
attributes in HTML tags.
To find the HTML corresponding to a Web Element,
Right click on the element you want to find -> select Inspect
option in Chrome (Inspect Element
in Firefox).
If you want to evaluate XPath or CSS, Follow the steps:
Firebug
& Firepath
plugins to FirefoxInspect Element with Firebug
option -> takes you to the elements HTML code.You can try Xpath
or CSS selectors
in Firepath
tab.
Upvotes: 1