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
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.
for to get all of the fields?@for='bodystyle-5' because, HTML code contains for attribute. General syntax is //tag[@attributeName=attributeValue]. so, you can use any attribute in HTML like name, value, id, class etc.CSS selectors. apart from it, there is NO direct way to find. If you have any of ID, name, class name, link text, tag name then you can find directly using corresponding By. methods.
HTMLas text, not as images. Also add exception log if you got anybodiesid is set todivdid you want to select url inside that?class="unstyle boxed bu-list-three-colums"