[enter image description here][3]
driver.find_element_by_xpath("//div[@class='form-group field-user-terms required']/label").click()
I tried with the above xpath, instead of selecting checkbox. It is clicking on "Terms and conditions" link
CodePudding user response:
Try setting an implicit wait of maybe 10
seconds
driver.implicitly_wait(10)
OR
Set an explicit wait. An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "myXpath")))
element.click();
OR
element = driver.find_element(By.XPATH,"yourXpath")
driver.execute_script("arguments[0].click();", element)
CodePudding user response:
Haveyou tried copying the xpath of the line below the before::?