microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.4k forks source link

How to start WinAppDriver from Jenkins #1345

Open gis2all opened 4 years ago

gis2all commented 4 years ago

All my test scripts are automatically executed with Jenkins, but before all tests start, WinAppDriver must be manually started in CMD. I want to start WinAppDriver in Jenkins. If I call it directly, it will exit directly, causing the test script to fail to start. Is there a better way to avoid this problem?

image

gis2all commented 4 years ago

I saw a similar issue https://github.com/Microsoft/WinAppDriver/issues/367, I have tried this method but it didn't work

image

amitchouksey commented 4 years ago

I guess you can write a function to invoke the driver programmatically and and run this function as part of class initialization. It can be written is C# like this.

System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");

Wolfe1 commented 4 years ago

When we tried to get the winappdriver to start up and teardown at will on a windows 2016 server we had issues with the driver crashing immediately on start. It seemed like it was a permissions issue so we decided to use elevate.exe in a batch file to get the job done with a bat file:

cd "C:/Program Files (x86)/Windows Application Driver"
start /B elevate WinAppDriver.exe
exit
rburtnykx commented 4 years ago

I had a similar problem and 'start WinAppDriver.exe ...' didn't help. Looks like Jenkins kills all started processes after stage end or switch to an agent. This works for me: wmic process call create "winappdriver.exe" And if you want kill process after: WMIC PROCESS where name="winappdriver.exe" TERMINATE

smilinrobin commented 3 years ago

We were able to configure WAD on JENKINS using instructions here : https://github.com/microsoft/WinAppDriver/pull/1368

lovelyplanet2019 commented 2 years ago

May I know if any solution works for you? @gis2all

gis2all commented 2 years ago

@lovelyplanet2019 You can try to put the startup method to your test script, just like this python code

def start_winappdriver(executable_path: str, remote_debugging_port: int):
    """Start WinAppDriver
    Args:
        executable_path (str): WinAppDriver path
        remote_debugging_port (int): port
    """
    subprocess.Popen("{} {}".format(executable_path, remote_debugging_port))