I’m new using Jenkins. My goal is to run a unitest python file on Jenkins. My environment is Windows 10 with a Jenkins version 2.387.1. I’ve installed the default plugins and the additional python. The python file was created in Anaconda (Spyder) with a version of python 3.9.
The python code is the following:
from selenium import webdriver
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
self.driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))
urls = [
for url in urls:
# Navigate to the URL
wait = WebDriverWait(self.driver, 10)
if __name__ == '__main__':
I’ve created a Freestyle Project with a Build Steps as Execute Shell with the following commands:
By no response, I meant there is not output. The cd\ is to go to the root of the path. More details about my code is that the python file is executed within an anaconda virtual environment. I don’t know if this affects the procedure. I stack on how to configure the project to setup a job capable of executing a python file.
Well, this script has not print, however, the one executed does. About the pipeline, I didn’t configured one? it should be linked to the created project? How should I configured it? Apologies for too much questions.
You wrote you’re on windows but then you mentioned to use “execute shell”. Shell will only work on Unix, in a Freestyle project you need to use “execute windows batch”.
You posted a picture where one can see that you might have a misconfiguration in your job. You assigned a label where to execute the job but there is no agent available that has this label. So the job will never start.
@mawinter69 I’ve changed shell to batch and I’ve created an agent with the project name. I could executed it, however, I get this console output:
Started by user [rparada](http://localhost:8080/user/rparada) Running as SYSTEM Building in workspace C:\ProgramData\Jenkins\.jenkins\workspace\pythonCookies [pythonCookies] $ cmd /c call C:\Windows\TEMP\jenkins3692175436805402094.bat C:\ProgramData\Jenkins\.jenkins\workspace\pythonCookies>cd\ C:\>cd C:\Users\user\ C:\Users\user>py -m multicooki No installed Python found! C:\Users\user>exit 112 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE
I have installed all possible python plugins (with restart). The code works locally following the same steps. Why it says No installed Python found?
hard to tell why it is not found.
When you installed python did you install it as administrator making it available for all users? If not are you running your agent with the same user account used to install python?