简体   繁体   English

无法通过Selenium Webdriver单击CheckBox.getting错误元素不可见

[英]Not able to click on checkBox through selenium webdriver.getting error element not visible

在此处输入图片说明

I'm adding picture of My DOM and where i want to click(circled). 我要添加我的DOM的图片以及我想单击的位置(带圆圈)。 I have used 我用过

driver.findElement(By.id("itsId")).click()

and javascript for clicking on it but it is giving error element not visible.I can see Unselectable-ON in htlm is it have something to do with clicking? 和用于单击的javascript,但是它显示的错误元素不可见。我可以在htlm看到Unselectable-ON ,这与单击有关吗? I'm not able to click on any element present on page having unselectale ON. 我无法单击页面上存在的所有元素,而这些元素都已取消选中。

Try this: 尝试这个:

import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(By.id("chkObjectAccountsCheckboxAll")));
driver.findElement(By.id("chkObjectAccountsCheckboxAll")).click();

this will wait at least 10 seconds until element will be clickable. 这将至少等待10秒钟,直到元素可以单击为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM