Home > Enterprise >  button click on a certain button, but the class names are the same
button click on a certain button, but the class names are the same

Time:01-06

I've been trying to click on the open button but there a bunch of "opens" on the page. I tried using the xpath because there was a little difference but it still isnt clicking it once I get to that page this is what I have so far need some help please.

This is the code:

code

This is the error message I keep getting:

error message

CodePudding user response:

It is highly recommended that you put the codes in text format instead of image so better readability.

I noticed that the issue you are facing is likely due to typo.

//*[@id='pack-container'']/li[1]/div[2]/button[1]

You have an additional apostrophe / single quote in the ID. It should be

//*[@id='pack-container']/li[1]/div[2]/button[1]

CodePudding user response:

driver.find_element_by_xpath(
"//*[@id='pack-container']/li[1]/div[2]/button[1]").click()

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id='pack-container']/li[1]/div[2]/button[1]"} (Session info: chrome=108.0.5359.125)

  • Related