做点击操作时的错误WebDriverException: unknown error: Element is not clickable at point (958, 207).

xiaoxiao2021-02-27  329

selenium中进行点击操作时报错如下:

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (958, 207). Other element would receive the click: <div class="ant-spin-container ant-spin-blur">...</div>

  (Session info: chrome=55.0.2883.75)   (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 68 milliseconds Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'PC201611061244', ip: '192.168.89.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60' Session ID: b2b791e785d6232c55f494e30b90ae54

Driver info: org.openqa.selenium.chrome.ChromeDriver

原因:用selenium模拟用户单击元素时,JS有一个操作鼠标悬浮的时候会对元素进行修改

解决办法:用JS来操作元素

JavascriptExecutor js = (JavascriptExecutor) driver;

js.executeScript("arguments[0].click();",driver.findElement(By.xpath("a")));

转载请注明原文地址: https://www.6miu.com/read-3522.html

最新回复(0)