I just cannot find working way to select this element, tried by CSS and xpath, but nothing works.
<input type="submit" value="Submit">
This does not work:
driver.find_element_by_xpath("//*[@id='theform']/div[2]/input").click()
driver.find_element_by_css_selector(".submit[value='Submit']").click()
This does not work:
driver.find_element_by_xpath("//*[@id='theform']/div[2]/input").click() driver.find_element_by_css_selector(".submit[value='Submit']").click()
The first invocation likely does not work because the input descendant node is most likely too vague and ambiguous.
The second invocation doesn't work because .submit[value='Submit'] is searching for (in english)
Any element that has
class~="submit"ANDvalue="Submit"
The value attribute matches, but not the class selector.
You could find that element with a quick CSS selector:
driver.find_element_by_css_selector("input[type='submit']")
See Effective CSS Selectors to see how to formulate good CSS selectors, and why this selector above would work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With