microsoft / WinAppDriver

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

How to run WinAppDriver as a background process and get log files #47

Open denys-rwd opened 8 years ago

denys-rwd commented 8 years ago

I would like to run WinAppDriver as a background process and get log files. Is it possible to run WinAppDriver as a background process with administrator privileges? Is it possible to configure log file location and log level?

Thanks in advance

zumwald commented 8 years ago

@denys-rwd does running winappdriver.exe > path\to\my\log.txt solve your use case?

denys-rwd commented 8 years ago

Thanks. I don't want to redirect console log to file log, I want to configure log level and file location.

yodurr commented 7 years ago

log file level and location are features we would like to add.

We would support them how Appium does it with these arguments: --log-level --log /path/to/appium.log

dkotowicz commented 5 years ago

Does WinAppDriver work on background?

RealHarlekin commented 4 years ago

As this is my first post I like to start with a big "thank you" for your great work on the WinAppDriver.

For some time we experience crashes of the WAD and/or connection losses to the WAD. I can find a lot of these error in the open issues section ("Unexpected error", "Keep alive failure" e.g. #1035 ). We are pretty sure it is our application crashing the WinAppDriver as we were already able to fix some issues by re-designing our tests.

I think it would be a great help to many people to get a more detailed log file from WinAppDriver to identify potential issues in their own application. Nothing happened based on @yodurr 's proposal yet. Can you please either decide to implement this or close this topic? Or make the WinAppDriver open source so we can provide a PR. In your FAQ you state that "[you]’re investigating the possibility of open-sourcing the WinAppDriver code.

adubry75 commented 4 years ago

A more detailed log than the server response would be handy. I'm getting 500 Internal Error trying to get the pageSource:

GET /session/37F52E2A-75E9-4312-9C82-7AC9F2674048/source HTTP/1.1 Accept: application/json, image/png Host: 127.0.0.1:4723

and I'd like to know more details as to WHY it's giving me an internal error, it shows no details currently. Thanks for any help!

trashbat commented 4 years ago

Here's a crude way of launching WAD from PowerShell, as a hidden window and redirecting output to a log:

Start-Process -FilePath "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" -ArgumentList "127.0.0.1 4723/wd/hub" -WindowStyle Hidden -RedirectStandardOutput "C:\test\my.log"

Make sure the log file location is somewhere you have write permissions for, otherwise it'll silently fail to log anything. Also you'll need to strip all of the NUL characters from the log file, you can do this in vim like so:

:%s/[[:cntrl:]]//g

And you can't tail it from WSL, for some reason. Like I said, it's crude!