我写了一个简单的Selenium测试(打开一个页面)的安全网站在无头模式使用Chrome59测试版。
我在执行代码时遇到以下异常。初始化驱动程序时引发异常
当我在注释了headless选项(options.addArguments(“headless”)后重新运行脚本时,它显示了Chrome并运行良好,但我的目标是将其作为headless运行。你能谈谈你对解决我的问题的看法吗?
例外:在端口4971上启动ChromeDriver 2.29.461585(0BE2CD95F834E9EE7C46BC7CF405B483F5AE83B),只允许本地连接。线程“main”组织中出现异常。openqa。硒。WebDriverException:未知错误:Chrome无法启动:异常退出(驱动程序信息:chromedriver=2.29.461585(0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),平台=Mac OS X 10.12.2 x86_64)(警告:服务器未提供任何堆栈跟踪信息)命令持续时间或超时:60.14秒构建信息:版本:“3.4.0”,版本:“未知”,时间:“未知”
以下是步骤:我在Mac上使用带有SBT的Scala。Chrome59测试版ChromeDrive 2.29发布版。
添加了以下依赖项
Scala代码:
val username = "username"
val password = "password"
val domainname = "yoursecuredomain.com"
val browserMobProxyServer = new BrowserMobProxyServer()
browserMobProxyServer.start(0)
browserMobProxyServer.autoAuthorization(domainname, username, password, AuthType.BASIC)
val seleniumProxy = ClientUtil.createSeleniumProxy(browserMobProxyServer)
val options = new ChromeOptions()
options.addArguments("headless")
options.addArguments("--disable-gpu")
options.setBinary("""/Applications/Google Chrome.app/Contents/MacOS/Google Chrome""")
val desiredCapabilities = new DesiredCapabilities()
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options)
desiredCapabilities.setCapability(CapabilityType.PROXY, seleniumProxy)
val driver: WebDriver = new ChromeDriver(desiredCapabilities)
val baseUrlString = s"""https://$domainname"""
driver.navigate().to(baseUrlString)
Thread.sleep(3000)
println("title: " + driver.getTitle)
driver.quit()
browserMobProxyServer.abort()
根据2.29 webdriver notes页面,它说
----------ChromeDriver v2.29(2017-04-04)----------
所以你必须降低你的chrome版本以兼容最新的chrome webdriver。
来源:https://chromedriver.storage.googleapis.com/2.29/notes.txt
我正在尝试将browsermob设置为在我的selenium项目中工作。我正在寻找一种使用ChromeOptions来设置代理的方法,但是所有的资源都告诉我要使用ChromeOptions来处理其他的事情,然后在实例化一个新的ChromeDriver实例之前将它转换为DesiredCapabilities。 这是我的代码: 我使用的是maven存储库中的Webdriver版本2.44。这是我得到的
我正在尝试运行chrome selenium驱动程序并添加扩展: 这会引发一个错误:
我使用的是xcode版本:10.1appium版本:1.13.1 应用程序必须正确运行,没有错误,并启动应用程序
我是robolectric新手,我只想运行简单测试。 我使用Android Studio=>Gradle 如何找到错误的真正源头?零点异常在哪里?
在我的计算机上升级Gradle安装后,当以VS代码打开现有的Gradle项目时,我开始收到以下错误消息: 无法使用分级分发“https://services.Gradle.org/distributions/gradle-5.5.1-bin.zip”运行生成操作)。 我发现类似的问题随着不同的版本号四处飘荡,例如:无法使用Gradle发行版'https://services.Gradle.org/