Reputation: 1
I right clicked the button, selected "Inspect" command and copied and used both XPATH and full XPATH. Neither of them worked for any of the commands below.
xpath = '//*[@id="ember949"]/footer/button[1]'
xpath_full = '/html/body/div[3]/div/div[2]/artdeco-tabs/artdeco-tabpanel[2]/form/footer/button[1]'
button = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, xpath)))
button = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, xpath_full)))
Can someone please explain? Thank you.
Upvotes: 0
Views: 589
Reputation: 26
I would recommend using the Selector / CSS Selector. In the code just change
By.XPATH
to:
By.CSS_SELECTOR
and instead of copying the XPATH copy the Selector or in some cases CSS Selector.
Upvotes: 0
Reputation: 3213
You could try searching the entire page for a button element with the continue-btn
class:
//button[@class='continue-btn']
Upvotes: 0
Reputation: 3690
Without the HTML, I cannot give a definitive answer. Looks like the first id may be dynamic and could change. As for the second one, the full XPaths are brittle and I do not use them at all. There could be an iframe that you should switch to first.
Upvotes: 0