2
votes

I am observing the below error when i run a chrome browser open test case using robot framework.

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally

(unknown error: DevToolsActivePort file doesn't exist)

(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) (Driver info: chromedriver=72.0.3626.69 (3c16f8a135abc0d4da2dff33804db79b849a7c38),platform=Linux 4.4.0-31-generic x86_64)

pasted the robot script below :

*** settings ***

Library  Selenium2Library


*** Variables ***

${Browser}  Chrome
${URL}  https://www.google.com

*** Test Cases ***
TC001 Browser Start and Close
    Open Browser  ${URL}  ${Browser}

chrome versions used :

  • Chrome version 72
  • ChromeDriver 72.0.3626.69
4

4 Answers

1
votes

I solved it! using --no-sandbox

${chrome_options}=  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
Call Method    ${chrome_options}    add_argument    test-type
Call Method    ${chrome_options}    add_argument    --disable-extensions
Call Method    ${chrome_options}    add_argument    --headless
Call Method    ${chrome_options}    add_argument    --disable-gpu
Call Method    ${chrome_options}    add_argument    --no-sandbox
Create Webdriver    Chrome    chrome_options=${chrome_options}

Instead of

Open Browser    about:blank    headlesschrome
Open Browser    about:blank    chrome
0
votes

You also need to have Selenium updated, which you'll get if using the newest version of SeleniumLibrary (it was removed the "2" from the name).

Update your scripts for the new name and update with:

pip install -U robotframework-seleniumlibrary
0
votes

Try to change your chrome driver to version 2.45 based on http://chromedriver.chromium.org/downloads version 72 is supported by 2.45. :)

0
votes

Here is an approach that worked for me. We have to pass the chrome_options and chrome web driver path while opening the browser. Please find the code below.

*** Settings ***
Library           Selenium2Library

*** Variables ***
${URL}            https://www.google.com
${CHROMEDRIVER_PATH}        /usr/local/bin/chromedriver

*** Keywords ***
Open Website
    ${chrome_options}=  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
    Call Method    ${chrome_options}    add_argument    --no-sandbox
    Call Method    ${chrome_options}    add_argument    --headless
    Open Browser    ${URl}    chrome    options=${chrome_options}      executable_path=${CHROMEDRIVER_PATH}

*** Settings ***
Suite Setup       Open Website

NOTE: The chrome_options and executable_path have been passed directly to Open Browser command instead of creating a web driver (Because, for some reason, creating a web driver did not work for me. But passing arguments directly to the browser did)