Jump to content

WebDriver using edge browser not working in task scheduler


MRAJ
 Share

Recommended Posts

Hello,

I tried to schedule in task scheduler my webdriver UDF script using edge browser but it is not running and its failing but when i am running manually it is running fine without any issue. Please help if i am missing anywhere.

Link to comment
Share on other sites

#include "wd_core.au3"
#include "wd_helper.au3"


$_WD_DEBUG = $_WD_DEBUG_None ; Could also use $_WD_DEBUG_Error
Local $sDesiredCapabilities, $sSession, $sElement

SetupEdge()
_WD_Startup()
Sleep(2000)
;_WD_ConsoleVisible()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession,"$URL")
Sleep(4000)
_WD_DeleteSession($sSession)
_WD_Shutdown()


Func SetupEdge()

_WD_Option('Driver', 'msedgedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace (@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}'

EndFunc

_WD_DeleteSession($sSession)
_WD_Shutdown()

It is just simple script to run the URL of the website. I am not able to find any logs , in Task scheduler i am just seeing task successfully started and finished. I am trying to get logs and let you know if i can reproduce.

Link to comment
Share on other sites

You could also do something like this if you want to capture the UDF output --

; Comment out the following line in your script
;$_WD_DEBUG = $_WD_DEBUG_None ; Could also use $_WD_DEBUG_Error

$_WD_DEBUG = $_WD_DEBUG_Info ; Gives you the greatest level of details
_WD_Option('console', @ScriptDir & "\wdudf.log")

This will redirect the UDF output that normally goes to the Scite output panel to a file so that you can review it following the script execution.

Link to comment
Share on other sites

Link to comment
Share on other sites

If he can run it manually, he should have the rights to run under the same credentials with Task Scheduler, no ?  I suspect it is the way it was entered in Task Scheduler, but like you said we do not have much info...

Link to comment
Share on other sites

Attached are the logs. I am seeing in logs msedge is crashing due to RESPONSE InitSession ERROR unknown error: MSEdge failed to start: exited normally.
  (unknown error: DevToolsActivePort file doesn't exist), while running this error is not visible.

 

 

Edited by MRAJ
Link to comment
Share on other sites

Are you using a sandbox or something similar :

Quote

options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--no-sandbox"); // Bypass OS security model

 

Link to comment
Share on other sites


@MRAJ This issue has been discussed in great detail on the net. Just Google on the phrase "webdriver DevToolsActivePort file doesn't exist" and you'll find lots of discussion and potential solutions.

Can you tell us more about the task you created? Does the task execute under the logged in user's credentials?

Link to comment
Share on other sites

Hello Dan,

I tried solution like giving admin privilege to my scripts, path, even i changed the msedge to script directory, and schedule in task schedule like account to run which i logged in and script path to run. I search in net but not getting proper answer what i am doing through scheduling the script. upgrading and downloading the newer version of browser and webdriver. Still i am researching on this. As it is running manually without any issue but if i schedule it is giving me issue.

Link to comment
Share on other sites

I just created a task like use the account which i logged in, Run only when user is logged in, Run with highest privileges, configure for OS, run every 5 mins,

Actions: path of the exe file.  and below is the page it will load and it will not go further, i tried to run using batch script and gave the path of the script and browser if may be exe file it is not accepting. I am not sure may be some compatible issue with Task scheduler or is there any bug with edge browser. Still i am trying best but not success still. and in net i found the below but not sure where to add. I tried to run using user account not admin but still same issue.

options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
options.addArguments("--no-sandbox"); // Bypass OS security model

 

 

image.thumb.png.10ad76fa54829506cf37a5849bf747a0.pngimage.thumb.png.10ad76fa54829506cf37a5849bf747a0.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...