小编Mix*_*Mix的帖子

Chromedriver 78可能存在问题,Selenium找不到在Chrome中打开的PDF的Web元素

在我的Google Chrome浏览器未更新到版本78之前,我的代码无法正常工作。我还将chromedriver更新为版本78.0.3904.70。因此,我无法再使用Selenium WebDriver和Java查找id ='plugin'的WebElement:

<html>
<div id="content">
<embed id="plugin" type="application/x-google-chrome-pdf" src="http://??????????/offer_printed.php?printable=yes&amp;reanudar=&amp;>
</div>
</html>
Run Code Online (Sandbox Code Playgroud)

除此之外,我的测试工作正常。我以前从未遇到过类似的问题。我也试图找到WebElement id ='content',但是我收到了同样的错误。

WebDriverWait wait = new WebDriverWait (driver, 90);
WebElement scrollvalid = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("plugin")));

scrollvalid.sendKeys(Keys.PAGE_DOWN);                       scrollvalid.sendKeys(Keys.PAGE_DOWN);
Run Code Online (Sandbox Code Playgroud)

我的自动化脚本应该找到PDF元素并向下滚动页面。相反,我收到此错误:org.openqa.selenium.TimeoutException:等待90秒后等待By.id定位的元素的可见性超时:插件

有人面临类似的问题吗?提前致谢。

java selenium selenium-chromedriver selenium-webdriver

16
推荐指数
1
解决办法
3813
查看次数