2
votes

Used Selenium Webdriver(V2.29), selenium-api version(3.4.0), Chrome Version (62.0.3202.94) 64 bit and tried to run chrome browser in linux machine with the below code.

    WebDriver driver;
    String chromeBinaryPath = "/data/Package/CHROME_NEW";
    String driverPath = "/data/Package/Selenium/WebDrivers/ChromeDrivers/chromedriver_linux32/chromedriver";

    System.setProperty("webdriver.chrome.driver", driverPath);
    System.setProperty("webdriver.chrome.verboseLogging","true");
    System.setProperty("webdriver.chrome.logfile","/data/Package/log/chromedriver.log");


    ChromeOptions optionsLinux64 = new ChromeOptions();

    optionsLinux64.setBinary(chromeBinaryPath);
    optionsLinux64.addArguments("--headless");
    optionsLinux64.addArguments("--no-sandbox");
    optionsLinux64.addArguments("--disable-gpu");
    optionsLinux64.addArguments("--headless");

    driver = new ChromeDriver(optionsLinux64);

When tried to create a chrome session, getting below exception:

unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.10.0-693.5.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.10 seconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'el4014.bc', ip: '10.120.94.70', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.5.2.el7.x86_64', java.version: '1.8.0_151' Driver info: driver.version: ChromeDriver

Installed Chrome at /data/Package/CHROME_NEW folder using rpm file.

Message in chromedriver.log:

[0.204][DEBUG]: DevTools request: http://localhost:12111/json/version
LaunchProcess: failed to execvp:
/data/Package/CHROME_NEW/
[0.379][DEBUG]: DevTools request failed

Can anyone help me in resolving with the above issue.

2

2 Answers

1
votes

This should be work:

ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
0
votes

Try adding window size optionsLinux64.addArguments("window-size=1024x780");