0

enter image description here

[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

  • There will be separate locator for checkbox., try to inspect the near by locator, i can no see the full `HTML` in screenshot, but you may try the this xpath `//input[@type='checkbox']` to select the checkbox – Akzy Jun 12 '22 at 10:46
  • driver.find_element_by_xpath("//input[@type='checkbox' and @id='user-terms']").click() I tried this xpath, but it is throwing error as "element not interactable" – Amritha Ravikumar Jun 13 '22 at 04:22
  • driver.find_element_by_xpath("//input[@type='checkbox' and @id='user-terms']").click() I tried with this xpath, but it is throwing error as "element not interactable" I have attached the full html, Please check – Amritha Ravikumar Jun 13 '22 at 04:52
  • I have added the answer, add the full `HTML` for `element` if you still face the issue – Akzy Jun 13 '22 at 08:42

2 Answers2

0

Haveyou tried copying the xpath of the line below the before::?

DGStar
  • 17
  • 7
0

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)
Akzy
  • 1,817
  • 1
  • 7
  • 19