WinAppDriver icon indicating copy to clipboard operation
WinAppDriver copied to clipboard

How to start WinAppDriver from Jenkins

Open gis2all opened this issue 6 years ago • 7 comments

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 avatar Oct 20 '20 09:10 gis2all

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

image

gis2all avatar Oct 20 '20 09:10 gis2all

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");

amitchouksey avatar Oct 20 '20 10:10 amitchouksey

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

Wolfe1 avatar Oct 20 '20 13:10 Wolfe1

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

rburtnykx avatar Oct 27 '20 22:10 rburtnykx

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

smilinrobin avatar Nov 17 '20 07:11 smilinrobin

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

lovelyplanet2019 avatar Oct 25 '22 14:10 lovelyplanet2019

@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))

gis2all avatar Nov 07 '22 02:11 gis2all