简体   繁体   中英

Clicking on xpath button with Selenium on Python

i used Selenium IDE on Firefox to find the xpath of buttons. The next step is to click the button on Python. I tried inserting the xpath in the code below, but no luck. I do not know how to change the xpath so that it fits to the code below.

browser.find_element_by_xpath('')

Any help is appreciated!

Be careful with quotes and double quotes, use double outside and simple inside, for example

"//*[@class='myClass']"

Try this:

browser.find_element_by_xpath("(//button[@type='button'])[20‌​9]")

You should get the selector manually in another way, this selector is not reliable at all, if any of the previous button is missing you will click the wrong button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM