1

HTML CODE

<div class="dropButton" style="color: rgba(0, 0, 0, 0.87); background-color: transparent; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; box-sizing: border-box; font-family: Roboto, sans-serif; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 10px, rgba(0, 0, 0, 0.23) 0px 3px 10px; border-radius: 50%; display: inline-block;"><button tabindex="0" type="button" style="border: 10px; box-sizing: border-box; display: inline-block; font-family: Roboto, sans-serif; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); cursor: pointer; text-decoration: none; margin: 0px; padding: 0px; outline: none; font-size: inherit; font-weight: inherit; position: relative; vertical-align: bottom; background-color: rgb(0, 188, 212); transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; height: 56px; width: 56px; overflow: hidden; border-radius: 50%; text-align: center;"><div><div style="transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; top: 0px;"><svg viewBox="0 0 24 24" style="display: inline-block; color: rgb(255, 255, 255); fill: rgb(255, 255, 255); height: 56px; width: 24px; user-select: none; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; line-height: 56px;"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path></svg></div></div></button></div>

There is no iframe I get this error Unable to locate element

I tried using this command

driver.find_element_by_xpath('//*[@id="root"]/div/div[2]/header/div/button/div/div/svg').click()
Dev
  • 2,739
  • 2
  • 21
  • 34

1 Answers1

1

Your xpath is not correct. Use .dropButton button css selector and WebDriverWait to wait element to be clickable. You can find helpful information about locator strategies here.

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, 15)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.dropButton button'))).click()

If there're more buttons with the selector add element with root id:

wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#root .dropButton button'))).click()
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Sers
  • 12,047
  • 2
  • 12
  • 31