【问题标题】:Testcontainers Selenium how to update browser?Testcontainers Selenium 如何更新浏览器?
【发布时间】:2020-05-27 20:09:57
【问题描述】:
我使用 Testcontainers (1.14.1) 和 Selenium (4.0.0-alpha-5) 和 Chrome 来运行我的 Java 集成测试。
但是当我运行我的测试时,我的 Angular 前端没有被渲染。我发现这是因为容器内的 Chrome 版本太旧了。 Chrome 的版本为 43。
所以要修复我的测试,我必须更新 Chrome。
但是怎么做呢?
【问题讨论】:
标签:
selenium
selenium-webdriver
selenium-chromedriver
testcontainers
【解决方案1】:
解决办法:使用最新稳定的 Selenium 版本!在我的情况下3.141.59
我是如何找到解决方案的:
据我所知,Selenium 当前的 Chrome 版本为 Docker Tags。
所以问题必须在 Testcontainers 方面。我搜索了他们如何知道要使用哪个容器标签并找到了这个:
/**
* Based on the JARs detected on the classpath, determine which version of selenium-api is available.
* @return the detected version of Selenium API, or DEFAULT_SELENIUM_VERSION if it could not be determined
*/
public static String determineClasspathSeleniumVersion() {
Whole source at GitHub
我查看了我的 Selenium API jar,清单中没有 Selenium-Version 的问题。 Selenium 的 4.0.0-alpha-5 没有容器标签。所以我只是降级到 Selenium 的最后一个稳定版本。