locked
Problems with Chrome/Selenium and Task Scheduler RRS feed

  • Question

  • I'm trying to run a batch script using Task Scheduler in Windows 10. The script launches a Javascript Selenium file, which launches a Chrome web browser, navigates to a Cisco wireless controller and logs in, then changes a security setting and logs back off.  The problem I've run into is that the task runs fine when launched manually within Task Scheduler, and also runs fine automatically when 'Run only when user is logged on' is checked AND the user is logged in.

    Whenever 'run whether user is logged on or not' is checked or the user account scheduling the task is logged in but the machine is locked (i.e., not looking directly at an open Windows desktop) the task begins but hangs indefinitely until manually stopped. 

    What seems to be happening is that the script launches Chrome successfully, but then focus isn't being placed on the Chrome window.  With the browser running in the background, the keyboard input that should go to the browser doesn't, thus the rest of the script hangs.  I suspect this might also be what's happening when I try to schedule the task to run as another user, or for it to run as hidden.


    Things I've tried (mostly from TechNet and other Stack Overflow posts):

    1. Changing user to run as to SYSTEM
    2. Checking 'Run with highest privileges'
    3. Manually adding user name to 'Log on as a Batch Job' setting in Group Policy
    4. Manually moved all files to the Administrator profile directory
    5. Unchecked 'Start only if computer is on AC power'
    6. Instead of calling my script directly under Actions as C:\Selenium\RunScript.bat, called it as C:\Windows\System32\cmd.exe /c C:\Selenium\RunScript.bat
    7. Set the 'start in' options to C:\Selenium

    Thanks for any help! For this to work, it has to run silently, as I never know when or how the host machine will be used at the two intervals during the day that the script needs to run. Therefore, I can't just leave it as 'Run only when user is logged on'.  Ideally, I need for the script to run silently in the background with no user interaction required, but if nothing else, I do need it to run when the correct user account is logged in but the machine is locked.  Thanks!!

    Sunday, November 5, 2017 12:05 AM

Answers

  • Sorry but this is not a task scheduler, Chrome or Selenium forum.  Perhaps you should ask the Chrome or Selenium folks for assistance.  This forum is only for Microsoft scripting technologies.

    Sorry.


    \_(ツ)_/

    • Marked as answer by drummingrocks Sunday, November 5, 2017 2:15 AM
    Sunday, November 5, 2017 1:19 AM

All replies

  • Sorry but this is not a task scheduler, Chrome or Selenium forum.  Perhaps you should ask the Chrome or Selenium folks for assistance.  This forum is only for Microsoft scripting technologies.

    Sorry.


    \_(ツ)_/

    • Marked as answer by drummingrocks Sunday, November 5, 2017 2:15 AM
    Sunday, November 5, 2017 1:19 AM
  • Thanks--my mistake.
    Sunday, November 5, 2017 2:15 AM
  • Did you ever find your answer?

    I'm having the same exact issue.

    Wednesday, June 6, 2018 5:59 PM
  • Hi, I more or less found a workaround.  I keep the PC logged in, which allows the script to run.  Other than that, I'm not really sure what could be done to make it work.
    Monday, June 11, 2018 10:58 AM
  • Hi, I more or less found a workaround.  I keep the PC logged in, which allows the script to run.  Other than that, I'm not really sure what could be done to make it work.

    You are still posting in the wrong forum.


    \_(ツ)_/

    Monday, June 11, 2018 11:13 AM
  • I had the same issue and the solution was to run the Windows Scheduled Task as "Administrators" (with "s").
    Thursday, October 11, 2018 10:49 AM
  • I had the same issue and the solution was to run the Windows Scheduled Task as "Administrators" (with "s").

    A very dangerous thing to do.


    \_(ツ)_/

    Thursday, October 11, 2018 5:36 PM