I'm looking for Unique Xpath for this element (Select) in google language settings https://myaccount.google.com/language?hl=en already have this xpath but I need something more accurate and unique
WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='yDmH0d']/div[11]/div/div[2]/div[3]/div[2]/button"))).click()
CodePudding user response:
If you pay attention to the HTMLDOM :
You can construct a xpath
based on attribute name only. You do not need their values
nor their text
.
//div[@data-is-touch-wrapper]/button[@data-id and @aria-label]
represent two matching nodes.
(//div[@data-is-touch-wrapper]/button[@data-id and @aria-label])[2]
should get the job done.
CodePudding user response:
I would try to copy the X-Path from the Browser as discribed here: Mozilla Help
My result would be: //*[@id="lang-selector"]