selenium-webdriverjenkins-pipelinepyautogui

can you run PyautoGUI in jenkins pipeline (headless)?


I tried using VNC but I couldn't run pyautogui on jenkins pipeline, I kept getting display error. Also tired running the project on selenium grid still pyautogui is not running in the background. Any solution to send run pyautogui in jenkins pipeline (headless)? Thanks in Advance

stages {
    stage('Test') {
        steps {

            container(name:'python'){
            sh """
            echo '********* Build Stage Started **********'
            pip install --upgrade pip
            pip install selenium-wire
            pip install pyautogui
            behave -D browser=remote features/Aggregation/avg.feature --tags=@createTransformation
            """
            }

Solution

  • Basically: No, not in headless

    Imagine pyautogui as being a user with a mouse and keyboard. How is it supposed to interact with a Window which isn't shown?

    A solution might be using pyvirtualdisplay without headless.

    Note: Pyautogui only works for one user at a time, you might consider other solutions for parallel automation