We are experiencing an issue when running Python Script via Jenkins, the browsers refuse to open up the URL, however, when we run them manually, then it works.
Pre Requirement:
Firstly, Need to create a project in Jenkins.
Next, In the project configuration-> Build section need to add below details.
For example:-
cd <Python_Script_Folder_Path>
python <Python_File_Name>.py
My Python Sample Script:
import webbrowser
import subprocess
mycmd = r'start chrome /new-tab {}'.format("https://outlook.office.com")
n2 = subprocess.Popen(mycmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
post-execution process:
Firstly, go to the Jenkins project and click on Build Now option.
Expected Result:
Default browser should be open along with given URL.
Issue:
The script is running successfully but browser not opening.
Note: If you run python script via cmd prompt or any IDE works perfectly.