简体   繁体   中英

Browsers not launching through Jenkins using python script

Python script will help us to open new browser, When we run the script via any ide(cmd prompt) new browser will open but when the same script run via jenkins project it will not open browser.

Currently working on creating new jenkins project and adding my python script on that same project. Jenkin project will build at specific time. meanwhile python script will run.

My Python Code:

import webbrowser

webbrowser.open(' https://www.google.com/ ', new = 2)

Can any one help me out to open a browser when i run the python script via jenkin's project.

u need headless browser plugin

in jenkins there plugin call Xvfb plugin

use of xvfb pugin

  1. Jenkins --> Plugin Manager --> avalible tab --> search xvfb and install
  2. Jenkins--> Global Tool Configuration

    • Xvfb installation under this
    • enter name
    • Directory in which to find Xvfb executable /usr/bin (its for ubuntu)

      1. click save

then go to your jobs ==> Configure --> under Build Environment enable tick here Start Xvfb before the build, and shut it down after.

Installing and Configuring xvfb here you can refer how to install xvfb in your pc

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