Hi,
I am working on UI automation using the Robot Framework Selenium library. Currently, the code is in my local repository, but I would like to create a test pipeline(Azure Devops). However, I am facing the following challenges:
How can I set up the ChromeDriver path when ‘executable_path’ is not supported by WebDriver?
Do I need to install chrome while executing in headless mode
Would be great if you could help me with an example/best practices to be followed.
In looking for a workaround I think I’ve found one.
This is not tested yet
There is another python module for updating selenium drivers it’s called webdriver-manager not webdrivermanager, yeah the names are confusingly similar
webdriver-manager doesn’t have a commandline interface
however if we install it with pip install webdriver-manager
Then add the following line before any SeleniumLibrary keywords
Thank you, Damies, for the quick response. It seems to have solved most of my problem. However, I get the following error when I execute scripts in the Azure DevOps pipeline.
SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally.
(session not created: 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.)
For example If it’s a linux machine it needs the DISPLAY variable set in the OS, for that you will need a Display (X11 or Wayland), if it’s a VM or Docker container with no graphics card, then use XVFB.
Chrome (and most other browsers) won’t run without a GUI even when running headless.
I am executing it in an Azure VM, and I don’t think it has a UI. So, I assume I have to use XVFB. Please let me know if you have any references or snippets.
Sorry I’m not familiar with Azure VM’s, from the website there appears to be Windows and Linux VM’s but it doesn’t say which Linux distro so I won’t be able to give you exact instructions.
As an overview if you’re using Linux you’ll need to:
install XVFB with your package manager (On Debian based distro’s use apt install xvfb
configure XVFB’s display number and run XVFB
Set the operating system variable $DISPLAY for the XVFB display number
run your robot test as the user where you configured the $DISPLAY variable
Windows VM’s already should have a GUI so if you’re using a Windows VM you have a different issue.
I am not sure if I need to create a new thread for this query. I am getting below error when trying to execute same in GitLab.
++ inside Docker
I am using xvfb-run command to execute robotframework tests
Suite setup failed:
(session not created: 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.)
I’m not sure, I never used xvfb-run, I just ran xvfb as a background process before running robot and that’s what worked for me.
I had the pip installs between starting xvfb and running robot and that maybe gave xvfb enough time to startup and be ready for applications, and maybe using xvfb-run is not, but I’m just guessing here.