How to hide scheduled Selenium/ChromeDriver Tests in Windows - selenium-webdriver

We have automated web tests which use the chromedriver.exe and which have proved difficult to automate and schedule. The only way were able to run them on a scheduled task was to run as the group "Administrators". Any other user (even admins) and the task simply did not run.
Anyhow, the problem now is that the task windows pop up constantly when we are on the server. Checking the "hidden" box has not helped, they still pop up.
How can we run these tasks silently in the background?
Notes:
We are running chromedriver in "headless" mode i.e. no Chrome GUI.
We have tried the HideCommandPromptWindow option to no avail

Related

Automating Tortoise SVN Update Fails While User Execution Succeeds

I have a few files i want to make sure I keep up to date using Tortoise SVN. I've used commandline and also created a batch file and both run successfully when I user-execute them.
However, when I use Windows Task Scheduler to try and schedule an automation for the batch script, it doesn't run successfully; it just hangs and runs endlessly. The log file looks just the same whether using the automation or not. That said, I have to manually end the automation in task scheduler and then run an SVN cleanup command to remove the locks that remain on the file from the incomplete task.
What is causing this, and how do I make it so that the automation successfully runs and doesn't have the file-locking problem?
My back script's code is below:
svn update --accept theirs-conflict C:/MyFolder/myfile.R
For transparency, I've tried changing the option 'theirs-conflict' to other settings (and removing it completely). The symptoms are the same in every scenario.

ClickOnce Settings Not Found When Run from Command Line

I have a Windows Forms app that is deployed through ClickOnce. In the app, I take advantage of the application settings to store basic connection information. In the two years and 200+ updates since I've published the app and it's been in daily use, I've had no problems with individual users modifying their own settings, and having those settings retained when the application is relaunched and updated.
However, I am working on adding a feature into the app that allows for certain tasks to be scheduled in the Task Scheduler. Everything works fine (the task is scheduled, and the application is called with the correct parameters passed) however when the program is launched, the settings are not read.
I can replicate this by manually launching the application directly from the command line. The application opens, but the only settings available are the settings that shipped with the application initially.
My end question is this: How can I call my ClickOnce app from the command line and have it open the same way as if I'd launched it from the start menu?
Thanks!!
Looks like the answer is to point the Task Scheduler to launch the .appref-ms file that is found in the start menu shortcut. You can't just point to the .exe file.
This is most likely caused by the Command line launching the ClickOnce App under a different user.
Try launching the ClickOnce from Command line or Task scheduler, and loading up task manager and seeing which user the app is running. If it is running on a user other than the user you are logged in as, then you can either log in as the user it is running under (if it's not a system user) and setting what settings you want, or you could try impersonating the desired user through task scheduler.
If none of that is applicable, you could add a Command line switch that, if no settings are found, saves a set of default settings that match what you want.

Running a VBscript with system account

I have a VBScript which basically calls some Informatica CLI commands. These commands will take a long time to execute and the script runs in a Windows 2003 server.
cscript //B //Nologo <script> params...
Actually, I am calling this script from a .NET Winforms application. The idea is, even when form is closed, the script continues to run. It works fine, as long as user is logged on, i.e. even when winform is closed, the script runs as a (user) process and execute the command.
The problem is however when the user logs off (or) remote system (MSTSC) times out, the (cscript) process is killed.
Is there anyway this can be run as a system process so that even when user logs off, the script continues to run?
(Please note that running the .NET EXE as a Windows service is a last option, which is currently not viable..)
Only way I know to do this is a pretty dirty hack so you should at least consider the .NET service approach... Visual Studio offers great tools which allow you to make a Windows service very easily.
What you can do if that is really not an option is using the task scheduler. As long as you do not need user interactivity you can say a task should be "Run whether a user is logged on or not". If you do this you are allowed to use "SYSTEM" as the account to run the task with. So you can create your task executing your script without any trigger, and then manually trigger the task from the program.
There is no nice way to do this from C# but you can just execute schtasks /run /tn <taskname> or do a quick google search for some of the wrappers people wrote for this. The script will run (invisibly) in the background and survive user logoff if started that way.

Jenkins task to switch on monitor if it's switched off

I use Jenkins to run our builds. What I want to do is to wakeup the monitor before build starts. This is what I have done so far.
Use nircmdc.exe (http://www.nirsoft.net/utils/nircmd.html) and prepare a batch file to turn on monitor. I have tested the script through command prompt and it works fine.
Then I add a build step in Jenkins to execute windows batch file before running the ANT script. Then I remote start the build (via URL). Console shows that the batch file is being executed. But the monitors doesn't wake up.
Then I included a target in ANT to execute the same batch file and tested running the ANT via CMD. This wakes up the monitor and continue with the build steps.
But, if I run this ant script from Jenkins, everything works fine except waking up the monitor.
Is this something to do with privileges ?
Has someone done something similar?
Don't think I've ever heard of a requirement to wake up the monitor, so probably no one has done anything like this.
However, your problem is probably due to Jenkins process running in a separate session from your machine's console. Have a look at my answer here: Open Excel on Jenkins CI, it explains how to get around the session issue.

Debugging an app launched through scheduled tasks

How do I debug an application which is launched via scheduled tasks?
I have a simple application which works fine when double clicked to launch, but it doesn't work when launched through scheduled tasks.
I know how to debug projects on a local computer, but this application has no issues running on a local computer or on a different computer if launched manually by the user by double clicking the executable file.
I need a way to debug the application when it's being launched by scheduled tasks. Is this possible?
I would primarily suggest putting in some decent logging so that you can diagnose problems without resorting to the debugger. However, to launch the debugger, you can either attach it to an existing process in Visual Studio (using Debug/Attach to process... menu), or change the code to include the Debugger.Launch() method which will launch the debugger and attach it to the process. Of course all of this is dependent on your program actually being executed by the scheduler. If the scheduler doesn't execute the program, then the debugger obviously can't attach to it

Resources