Recently i’m facing an issue when try to run a task from Jenkins that simply run a .robot file.
I’ve been searching and trying different options from another colleagues that faced similar issues in StackOverFlow but i can’t achive to run the script correctly.
Please let me show you what i’m doing, my scripts and Jenkins setup so you can understand in a better way my problem.
I have this robot file:
*** Settings ***
Documentation Basic Test
Library SeleniumLibrary
*** Variables ***
#${result} /opt/google/chrome/chrome
${Browser} chrome
${options} binary_location = '/opt/google/chrome/chrome'
*** Test Cases ***
Abrir web Pangea
Open Browser url=https://www.google.com/ browser=${Browser} options=${options}
Close All Browsers
And i’m trying to run it as a Jenkin simple task with this simple build step:
robot --outputdir results --nostatusrc Test/basic_2.robot
But every time the Console Out show me the msg:
[Robot_QA_Executions] $ /bin/sh -xe /tmp/jenkins3290544249294601087.sh
+ robot --outputdir results --nostatusrc Test/basic_2.robot
==============================================================================
Basic 2 :: Basic Test
==============================================================================
Abrir web Pangea | FAIL |
WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
------------------------------------------------------------------------------
Basic 2 :: Basic Test | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
To be sure of the Chrome path and this kind of things i also create this Python file:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
# Ruta del controlador de Chrome
webdriver.ChromeOptions.binary_location = '/opt/google/chrome/chrome'
# Opciones para el navegador
ChromeOptions = webdriver.ChromeOptions()
ChromeOptions.add_argument('--headless')
# Crea una instancia del navegador Chrome
driver = webdriver.Chrome(chrome_options=ChromeOptions)
# Navega a la pagina web de Google Espana
driver.get("https://www.google.es")
print("google abierto")
time.sleep(2)
driver.get("https://pangea.es/")
print("pangea abierto")
# Cierra el navegador
time.sleep(10)
driver.quit()
print("fin del test")
And after run, also from jenkin task with the build Step:
#!/usr/bin/env python3 ./Test/ejemplo_Python_2.py
The Python Script works as expected.
Please can you help me to solve this issue? i tried with different optiones like “options”,“binary_location”, “executable_path” etc… with no success.
I also double-check that i have installed:
$ /opt/google/chrome/chrome --version
Google Chrome 110.0.5481.177
$ chromedriver --veresion
Starting ChromeDriver 110.0.5481.77 (65ed616c6e8ee3fe0ad64fe83796c020644d42af-refs/branch-heads/5481@{#839}) on port 9515
pip (9.0.3)
Pygments (2.14.0)
robotframework (6.0.2)
robotframework-datadriver (1.6.1)
robotframework-pythonlibcore (3.0.0)
robotframework-seleniumlibrary (6.0.0)
selenium (3.141.0)
setuptools (39.2.0)
urllib3 (1.26.14)
I would like to add more details to my issue.
If i try with
Create Webdriver Chrome executable_path=/usr/local/bin/chromedriver
Go To https://www.google.com
instead OpenBrowser. Jenkins return the error msg:
WebDriverException: Message: Service /opt/google/chrome/chrome unexpectedly exited. Status code was: 1
I expect to be able to run *.robot files from a Jenkins task (My Jenkins is over a AWS Linux machine) and the repositoty it’s on GitLab.