Selenium chromedriver unknown error when running chrome 59 headless with a proxy browser

I wrote a simple Selenium test (page opening) of a secure site in headless mode using the beta version of Chrome 59.

When I execute my code, I get the following exception. An exception is thrown when the driver is initialized.

When I restart my script after commenting on the headless option (options.addArguments ("headless"), it shows Chrome and works fine, but my goal is to run it as headless. Could you express your thoughts on solving my problem?

Exception: Running ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 4971 Only local connections are allowed. Exclusion from the stream "main" org.openqa.selenium.WebDriverException: unknown error: Chrome could not be started: anonymously exited (Driver Information: chromedriver = 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b), platform = Mac OS X 10.2.12 : the server did not provide any information about the stack) Duration or timeout of the command: 60.14 seconds Assembly information: version: "3.4.0", version: "unknown", time: "unknown"

Here are the steps: I am using Scala with SBT on Mac. Chrome Beta 59 ChromeDrive 2.29 Release Version.

The following dependencies are added.

  • "org.seleniumhq.selenium"% "selenium-chrome-driver"% "3.4.0"
  • "org.seleniumhq.selenium" % "selenium-support" % "3.4.0"
  • "net.lightbody.bmp" % "browserermob-core" % "2.1.4"

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()
+4
1

2.29 webdriver notes, ,

---------- ChromeDriver v2.29 (2017-04-04) ----------

Chrome v56-58

chrome, -webdriver.

: https://chromedriver.storage.googleapis.com/2.29/notes.txt

+2

Source: https://habr.com/ru/post/1676954/


All Articles