Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running winappdriver in the background piped to a log file #851

Open
fenchu opened this issue Sep 6, 2019 · 7 comments
Open

Running winappdriver in the background piped to a log file #851

fenchu opened this issue Sep 6, 2019 · 7 comments

Comments

@fenchu
Copy link

fenchu commented Sep 6, 2019

if I start a new powershell and execute winappdriver it is all fine, but I need it to behave more like chromedriver and geckodriver, that I can start it in the background and it logs to file. and no output in the console. No extra console open.

I tried several combinations of:
& { Start-Job 'C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe' | Out-File .\winappdriver.out.txt}

Would be nice to get some info on how to set up this.

`(get-command("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe")).Version

Major Minor Build Revision


1 1 1903 8001 `

@naeemakram
Copy link

I tried the following command after reading your question and it worked:
"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" > winappdriverlog.txt

To add a random number to the file name:

"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" > runlog%RANDOM%.txt

@fenchu
Copy link
Author

fenchu commented Sep 6, 2019

@naeemakram Thanks for your reply, but unfortunately it closes the connection and you get the return prompt:
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=4723): Max retries exceeded with url
Need to run in the background in the same session writing log to file.

@naeemakram
Copy link

It didn't close the connection in my case. Something is not quite right on your side I suppose. I even got the text log file in place.
Please double check WinAppDriver port number. I suspect yours is running on port number other than 4723.

@fenchu
Copy link
Author

fenchu commented Sep 10, 2019

I get this to work:

& { Start-Process -NoNewWindow 'C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe' -RedirectStandardOutput .\winappdriver.txt }

@naeemakram
Copy link

That's great! Thanks very much for sharing the solution.

@naeemakram
Copy link

How do we know that the driver is running in the background or not? I tried a couple of times and I found that the driver closes without any notice.
For example I performed the following sequence:

  1. Executed the command you shared first
  2. Run a bunch of tests from Visual Studio
  3. Go back to same instance of PowerShell and type .\winappdriver.txt

In first attempt the file didn't open, the PS session stayed stuck where it was. I then pressed enter a few times and typed file name again.
This time the file opened but WinAppDriver closed, it can be seen in the file attached.
winappdriver.txt

@naeemakram
Copy link

Hi, I've published a course about test automation using WinAppDriver. Given below is a special launch promo code(valid 4 days).
Automated UI Testing Windows Apps in Appium WinAppDriver, C#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants