Home > Software design >  XPath is not clicking the CheckBox despite being correct
XPath is not clicking the CheckBox despite being correct

Time:06-15

[Elements Window]

selectcheckbox = driver.find_element(By.XPATH, "//*[@id=\"infiniteScroll\"]/div/div[1]/div/input")
selectcheckbox.click()

I have tried the above code to click on the checkbox and as it can be seen in the attached image the XPath mentioned in the above code seems correct because when we find this XPath in the elements window it gets highlighted.

Please suggest: is there anything missing in the code?

CodePudding user response:

You can simply get element by using class selectcheckbox = driver.find_element(By.CLASS, "selectordersCBALL");

CodePudding user response:

Try with ActionChains

selectcheckbox = driver.find_element(By.XPATH, "//*[@id=\"infiniteScroll\"]/div/div[1]/div/input")
selectcheckbox.click()

webdriver.ActionChains(driver).move_to_element(selectcheckbox ).click(selectcheckbox ).perform()
  • Related