Interact Elements With Dynamic Label In Python Selenium
Python newbie here. All of 1 month old. Most of the elements in page i am trying to scrape, i am able to handle them and interact with them. there are two elements that have dyn
Solution 1:
If Add Your Key
is unique then you can use the below xpath :
//span[contains(text(), 'Add Your Key')]//preceding-sibling::input[@class='a-button-input']
or even without class :
//span[contains(text(), 'Add Your Key')]//preceding-sibling::input
and use it like this :
objAddKey = driver.find_element_by_xpath("//span[contains(text(), 'Add Your Key')]//preceding-sibling::input")
objAddKey.click()
I would suggest you to have explicit waits for more reliability.
Post a Comment for "Interact Elements With Dynamic Label In Python Selenium"