Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Click正在工作,但它抛出错误org.openqa.selenium.ElementNotVisibleException:元素当前不可见_Selenium_Xpath_Css Selectors_Webdriver_Element - Fatal编程技术网

Click正在工作,但它抛出错误org.openqa.selenium.ElementNotVisibleException:元素当前不可见

Click正在工作,但它抛出错误org.openqa.selenium.ElementNotVisibleException:元素当前不可见,selenium,xpath,css-selectors,webdriver,element,Selenium,Xpath,Css Selectors,Webdriver,Element,我使用cssselector、xpath和linktext来单击下拉列表项,所有操作都正常,它单击元素,但同时抛出异常元素NotVisibleException!DOM中也没有重复的元素 我使用的是selenium-server-standalone-2.45.0,还尝试将其更新为2.48.2,但错误仍然存在。 在firefox和chrome上都尝试过,但结果相同。有什么想法吗?尝试使用JavascriptExecutor单击您的按钮 使用下面的代码点击按钮 WebElement element

我使用cssselector、xpath和linktext来单击下拉列表项,所有操作都正常,它单击元素,但同时抛出异常元素NotVisibleException!DOM中也没有重复的元素

我使用的是selenium-server-standalone-2.45.0,还尝试将其更新为2.48.2,但错误仍然存在。
在firefox和chrome上都尝试过,但结果相同。有什么想法吗?

尝试使用JavascriptExecutor单击您的按钮

使用下面的代码点击按钮

WebElement element= driver.findElement(YOUR LOCATOR for button);

JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);

希望它能帮助您:)

请提供用于识别元素的简短HTML和选择器