WebDriverException: Message: Unknown error: Unrecognized version of Chrome: HeadlessChrome RobotFramework

I am trying to use the headless google-chrome function in my ubuntu machine to run headless selenium scripts. Next up is the script that I run

headless.robot

  *** Settings ***
    Documentation     This example demonstrates how to use current library
    Library      Selenium2Library

    *** Test cases ***
   Open Browser with Chrome options in headless mode
        ${options}  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
        Call Method  ${options}  add_argument  --start-maximized
        Call Method  ${options}  add_argument  --headless
        Call Method  ${options}  add_argument  --disable-gpu
        #Call Method  ${options}  add_argument  --remote-debugging-port=${9222}
        Create WebDriver  Chrome    chrome_options=${options}
        Go To    https://www.google.com    
        ${title}=    Get Title    
        Log to console    ${title}

pybot headless.robot

==============================================================================
Headless :: This example demonstrates how to use current library              
==============================================================================
[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No browser is open
Open Browser with Chrome options for configuring data source          | FAIL |
WebDriverException: Message: unknown error: unrecognized Chrome version: HeadlessChrome/59.0.3071.86
  (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 3.13.0-119-generic x86_64)
------------------------------------------------------------------------------
Headless :: This example demonstrates how to use current library      | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /var/robot-tests/output.xml
Log:     /var/robot-tests/log.html
Report:  /var/robot-tests/report.html

chromedriver --version

ChromeDriver 2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac)

google-chrome --version

Google Chrome 59.0.3071.86

Dependency Modules Installed

apt-get install -y xvfb fluxbox x11vnc dbus libasound2 libqt4-dbus libqt4-network libqtcore4 libqtgui4 libxss1 libpython2.7 libqt4-xml libaudio2 fontconfig liblcms1 lib32stdc++6 libc6-i386 lib32gcc1 nano
+4
source share
1 answer

chromedriver - v2.30; ​​ 2.29 ( ).
, remote_debugging_port.

Btw, , ${options}, _ ${preferences} - ?

+2

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


All Articles