简体   繁体   中英

How to execute selenium tests in GUI mode in Azure VM instance in which jenkins is installed

I have on VM with Jenkins installed hosted in Azure which is Linux operating system.I want to execute the selenium scripts in that VM through Jenkins.I am able to execute the tests in headless mode.But the problem here is I need to run the tests in GUI mode.Is there any workaround to run the automation scripts in GUI mode.Below are the things I have tried to run in GUI mode.

  1. Installed chrome browser through putty and set the chrome binary path.
  2. Tried to access VM through xrdp.

But I am not able to execute in GUI mode.Any help will be much appreciated.

Chrome version : 65

Below is the error log :

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.13.0-36-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.15 seconds Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'

I found this example on Azure Pipelines repo. I only managed to get it working after I copied this piece of code and the file xvfb.init .

steps:
- script: |
    sudo cp .azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
    sudo chmod +x /etc/init.d/xvfb
    sudo update-rc.d xvfb defaults
    sudo service xvfb start
  displayName: 'Start X Virtual Frame Buffer'

- script: |
    export DISPLAY=:10
    gulp test
  displayName: 'Test'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM