0

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!

5
  • Be careful with quotes and double quotes, use double outside and simple inside, for example "//*[@class='myClass']" Commented Sep 3, 2016 at 21:04
  • Thanks, so i type in browser.find_element_by_xpath('//button[@type="button"]') , but how do i click for example the element with xpath=(//button[@type='button'])[209] Commented Sep 3, 2016 at 21:07
  • Add html section of the button if possible.You should get another selector manually, this selector is not reliable at all,If any of the previous button is changing you will click the wrong button. Try browser.find_element_by_xpath("(//button[@type='button'])[209]") Commented Sep 3, 2016 at 21:13
  • Thanks a lot! Working Perfectly, have a good day! Commented Sep 3, 2016 at 21:19
  • @lauda you should provide it is an answer and OP need to accept it. Thanks Commented Sep 4, 2016 at 5:34

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.