I have a button that html is below
I tired the following code
Execute_Button = driver.find_element("xPath",'//button[text()="Execute "]')
But Python comes up with this error message. How to solve?
InvalidArgumentException: Message: invalid argument: invalid locator
CodePudding user response:
According to docs (locating elements), locating by xpath can be done using locator By.XPATH
or 'xpath'
. In your code you use 'xPath'
, which is invalid. To fix that simply change it to one of the two I mentioned, i.e.
Execute_Button = driver.find_element(By.XPATH,'//button[text()="Execute "]')
CodePudding user response:
browser.find_element_by_xpath('//button[text()="Execute "]').click()