Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robot framework WebDriverException: Message: unknown error: Chrome failed to start:

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
like image 814
simha Avatar asked Nov 22 '25 12:11

simha


2 Answers

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
like image 77
Panup Pong Avatar answered Nov 25 '25 07:11

Panup Pong


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)

like image 33
Dhivya Dandapani Avatar answered Nov 25 '25 05:11

Dhivya Dandapani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!