Python Selenium Onclick Throws Elementnotinteractableexception
On a website I want to interact with using Selenium, there is the following part of the html code: <
Solution 1:
To click on the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:
Using
CSS_SELECTOR:WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a[onclick^='editToggle']>img[alt='change name'][title='change name']"))).click()Using
XPATH:WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[starts-with(@onclick, 'editToggle')]/img[@alt='change name' and @title='change name']"))).click()Note: You have to add the following imports :
from selenium.webdriver.support.uiimportWebDriverWaitfrom selenium.webdriver.common.byimportByfrom selenium.webdriver.supportimport expected_conditions asEC
Post a Comment for "Python Selenium Onclick Throws Elementnotinteractableexception"