Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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
Selenium 我想关闭一个弹出窗口。驱动程序无法在弹出窗口中找到十字(X)_Selenium_Selenium Webdriver_Css Selectors_Selenium Chromedriver - Fatal编程技术网

Selenium 我想关闭一个弹出窗口。驱动程序无法在弹出窗口中找到十字(X)

Selenium 我想关闭一个弹出窗口。驱动程序无法在弹出窗口中找到十字(X),selenium,selenium-webdriver,css-selectors,selenium-chromedriver,Selenium,Selenium Webdriver,Css Selectors,Selenium Chromedriver,我无法单击或关闭弹出窗口。没有其他元素可以定位并关闭窗口。下面是定位窗口时引发的错误。 我正在使用代码: WebElement noteDisplayWindow = driver.findElement(By.xpath("//body/div[2]/div[1]/button/span")); noteDisplayWindow.click(); 或者使用css选择器 WebElement noteDisplayWindow1=driver.findElement(By.cssSelect

我无法单击或关闭弹出窗口。没有其他元素可以定位并关闭窗口。下面是定位窗口时引发的错误。 我正在使用代码:

WebElement noteDisplayWindow = driver.findElement(By.xpath("//body/div[2]/div[1]/button/span"));
noteDisplayWindow.click();
或者使用css选择器

WebElement noteDisplayWindow1=driver.findElement(By.cssSelector("button[type='button'][class='ui-button']"));
noteDisplayWindow1.click();
当我运行CSS选择器时出现了这个错误

org.openqa.selenium.WebDriverException:未知错误:

Element <span class="abc xyz qwe yui"></span> is not clickable at point (968, 150). Other element would receive the click: <div class="xyz1[enter image description here][1] abc1 sdsd"></div>
元素在点(968150)处不可单击。其他元素将收到单击:
(会话信息:chrome=56.0.2924.87) (驱动程序信息:chromedriver=2.28.455520,平台=Windows NT 6.1.7601 SP1 x8664)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:67毫秒 构建信息:版本:“未知”,版本:“5234b32”,时间:“2017-03-10 09:00:17-0800”

尝试一下

WebElement myDynamicElement=driver.findElement(By.cssSelector("button[type='button'][class='ui-button']"));

new Actions(driver).moveToElement(myDynamicElement).click().perform();

“…无法单击或关闭弹出窗口”:什么弹出窗口?请提供一些HTML。它是一个弹出窗口,当我点击一个链接。而且它没有任何按钮。只需关闭(X符号)即可关闭弹出窗口。