Mahendra
Mahendra

Reputation: 35

Cannot click an element , Selenium Python

with selenium, i'm trying to click an element but not working with this element, the page is here page (username/password :admin/admin)

enter image description here

wait2 = WebDriverWait(driver, 10)
element = wait2.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="operate2a5a0448a8bf44a8898ec13e95b152fc"]/div/div[2]')))
element.click()

i tried this on other element in the same page and got no problem

no idea why not working on this element

Upvotes: 1

Views: 48

Answers (2)

cruisepandey
cruisepandey

Reputation: 29382

you can try with below code as well :

//img[contains(@src,'registration')]/..

in code :

wait2 = WebDriverWait(driver, 10)
element = wait2.until(EC.element_to_be_clickable((By.XPATH, "//img[contains(@src,'registration')]/..")))
element.click()

Upvotes: 1

Prophet
Prophet

Reputation: 33381

operate2a5a0448a8bf44a8898ec13e95b152fc seems to be dynamically created id.
The simplest way to access this element is with text based XPath locator:

wait2.until(EC.element_to_be_clickable((By.XPATH, "//div[contains(text(),'Entry Registration')]"))).click()

Upvotes: 1

Related Questions