5

I don't know what I'm doing wrong but for some reason it cannot find the chrome binary despite me using WebDriverManager. I put the logs below for reference but it supposedly cannot find the binary (or it cannot download the binary?) I found similar question everywhere but none of the solutions seem to work.

Setup

WebDriverManager.chromedriver()
        .targetPath("/tmp")
        .setup();
ChromeOptions options = new ChromeOptions();
options.addArguments(
        "--no-sandbox",
        "--disable-gpu",
        "--enable-javascript",
        "disable-infobars",
        "--disable-dev-shm-usage",
        "--disable-extensions",
        "--headless",
        "--user-data-dir=/tmp/user-data",
        "--data-path=/tmp/data-path",
        "--homedir=/tmp",
        "--disk-cache-dir=/tmp/cache-dir",
        "window-size=1400,600",
        "log-level=3");
this.driver = (WebDriver) new ChromeDriver(options);
this.driver.manage().deleteAllCookies();
this.driver.manage().window().fullscreen();

POM

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.10.0</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.webdriver</groupId>
    <artifactId>webdriver-common</artifactId>
    <version>0.9.7376</version>
</dependency>

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.7.1</version>
</dependency>

Logs

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Nov 01, 2019 9:41:27 AM java.util.prefs.FileSystemPreferences$1 run
WARNING: Couldn't create user preferences directory. User preferences are unusable.
Nov 01, 2019 9:41:27 AM java.util.prefs.FileSystemPreferences$1 run
WARNING: java.io.IOException: No such file or directory
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800}) on port 24233
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1572601288.635][SEVERE]: CreatePlatformSocket() failed: Address family not supported by protocol (97)
unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-128-181.eu-west-2.compute.internal', ip: '10.128.128.181', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x563e5f6197e9 <unknown>
: org.openqa.selenium.WebDriverException
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-128-181.eu-west-2.compute.internal', ip: '10.128.128.181', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x563e5f6197e9 <unknown>

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:138)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
at Controllers.ChromeDriverController.<init>(ChromeDriverController.java:73)
at Controllers.APIController.createCustomer(APIController.java:735)
at com.amazonaws.lambda.creation.CreateOrg.handleRequest(CreateOrg.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

New Logs

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Nov 01, 2019 1:40:32 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: Couldn't create user preferences directory. User preferences are unusable.
Nov 01, 2019 1:40:32 PM java.util.prefs.FileSystemPreferences$1 run
WARNING: java.io.IOException: No such file or directory
Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800}) on port 8973
Only local connections are allowed.
Please protect ports used by ChromeD[1572615634.489][SEVERriver and rE]: CreatePlatformSocket() failed: Address family not supported by protocol (97)
elated test frameworks to prevent access by malicious code.
unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-42-38.eu-west-2.compute.internal', ip: '10.128.42.38', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x55f3c74477e9 <unknown>
: org.openqa.selenium.WebDriverException
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-42-38.eu-west-2.compute.internal', ip: '10.128.42.38', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x55f3c74477e9 <unknown>

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:122)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
at Controllers.ChromeDriverController.<init>(ChromeDriverController.java:73)
at Controllers.APIController.createCustomer(APIController.java:735)
at com.amazonaws.lambda.creation.CreateOrg.handleRequest(CreateOrg.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Meerfall the dewott
  • 209
  • 1
  • 4
  • 19

1 Answers1

1

This error message...

[1572601288.635][SEVERE]: CreatePlatformSocket() failed: Address family not supported by protocol (97)
unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-128-181.eu-west-2.compute.internal', ip: '10.128.128.181', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x563e5f6197e9 <unknown>
: org.openqa.selenium.WebDriverException
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ip-10-128-128-181.eu-west-2.compute.internal', ip: '10.128.128.181', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.146-93.123.amzn1.x86_64', java.version: '1.8.0_201'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x563e5f6197e9 <unknown>

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • As you are using:

    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.7.1</version>
    </dependency>
    
  • Presumably this would in-turn download and use the latest chromedriver=78.0

  • Release Notes of chromedriver=78.0 clearly mentions the following :

Supports Chrome version 78

  • Presumably you are using chrome= 78.0.
  • But your Selenium Client version is 3.10.0 which is almost 2 years older.
  • Your JDK version is 1.8.0_201 is a bit older.

So there is a clear mismatch between the JDK v8u201 , Selenium Client v3.10.0 , ChromeDriver v78.0 and the Chrome Browser v78.0


Solution

Ensure that:

  • Selenium is upgraded to current levels Version 3.141.59.
  • JDK is upgraded to current levels JDK 8u222.
  • ChromeDriver is updated to current ChromeDriver v78.0 level.
  • Chrome is updated to current Chrome Version 78.0 level. (as per ChromeDriver v78.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Outro

CreatePlatformSocket() returned an error: An invalid argument was supplied. (0x2726) when trying to access chromedriver through network path

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I can only use selenium 3.14.0 at highest due to issues with it being unzippable in aws if it goes any higher. Would downgrading the web driver manager work? – Meerfall the dewott Nov 01 '19 at 12:01
  • @Meerfallthedewott First try with _selenium 3.14.0_, if the issue persists update the question with the observation and try out the second option of _downgrading the web driver manager_ – undetected Selenium Nov 01 '19 at 12:16
  • I tried with the latest verison of selenium. It won't zip. I went down the verisons and got 3.14.0 (as expected) to work. Which verison of WebDriverManager would you recommend? – Meerfall the dewott Nov 01 '19 at 13:01
  • @Meerfallthedewott With Selenium v3.14.0 the latest version of WebDriverManager should work. Can you give it a try and update me the status please? – undetected Selenium Nov 01 '19 at 13:12
  • i've tried with the latest verison and verison 3.1 and 3.4 (webdrivermanager) and its coming up with the same error – Meerfall the dewott Nov 01 '19 at 13:13
  • I put the (newer) logs up there as i see a slight variation with the createPlatformSocket error. – Meerfall the dewott Nov 01 '19 at 13:45
  • @Meerfallthedewott Did you checkout the discussion mentioned within the _Outro_ section and the links within that discussion? – undetected Selenium Nov 01 '19 at 13:54
  • I'm not sure how the outro relates to this error as the sample you took shows it requires two createPlatformSocket errors or a createPlaformSocket error and a IPv4 error. More or less its talking about windows versions. The logs are retrieved from a linex verison (and it works locally on a windows version so that is not the issue). Also I have no control over where the driver is placed. It has to be placed in the "/tmp" file for aws to ensure you can read and write from it. i will try "C://tmp" but i'm absolutely sure it will not work. Is there anything else I can try? – Meerfall the dewott Nov 01 '19 at 14:02
  • I got this error from attempting to use C://tmp "errorMessage": "java.lang.IllegalArgumentException: Parameter 'directory' is not a directory: C:/tmp" – Meerfall the dewott Nov 01 '19 at 14:09
  • See CreatePlatformSocket() failed: Address family not supported by protocol (97), it looks like ipv6 is not supported but required for chrome. – nanvel Nov 09 '20 at 06:20
  • In my case I had to increase my Lambda function memory to 2048mb, the issue was that it was running out of memory but for some reason that didn't show up in the logs – César Muñoz Apr 26 '22 at 11:24