Jump to content

Recommended Posts

Posted

Hello i am running the below code in my server using task scheduler at certain intervals like every 10 mins and its running fine when its in logged in but when i close the server(not signed out, i just lock) , its stops running, not sure why it is only happening when i using the IEDriverserver.exe to run edge in IE mode. I am asking because i am running many scripts using msedgedriver webdriver UDF and IE and its running fine even i close the server. Please suggest.

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


Local $sSession, $sElement,$sCapabilities

Local $sCapabilities = SetupEdgeIEMode()

_WD_Startup()
 $sSession = _WD_CreateSession($sCapabilities)

_WD_Navigate($sSession, "URL")
   _WD_Window($sSession,"maximize")

_WD_LoadWait($sSession)



$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='unamebean']")

_WD_SetElementValue($sSession,$sElement,"username")
Sleep(2000)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='pwdbean']")

_WD_SetElementValue($sSession,$sElement,"password")
Sleep(2000)
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@id='SubmitButton']")

_WD_ElementAction($sSession,$sElement,'click')


_WD_DeleteSession($sSession)
_WD_Shutdown()

Func SetupEdgeIEMode() ; this is for MS Edge IE Mode
    
    Local $sTimeStamp = @YEAR & '-' & @MON & '-' & @MDAY & '_' & @HOUR & @MIN & @SEC
    _WD_Option('Driver', 'IEDriverServer.exe') ;
    

    ;_WD_Option('Port', _WD_GetFreePort(5555, 5600))
    Local $iPort = _WD_GetFreePort(5555, 5600)
    If @error Then Return SetError(@error, @extended, 0)
    _WD_Option('Port', $iPort)
    _WD_Option('DriverParams', '-log-file="' & @ScriptDir & '\log\' & $sTimeStamp & '_WebDriver_EdgeIEMode.log" -log-level=INFO' & " -port=" & $_WD_PORT & " -host=127.0.0.1")
    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'msedgeie')
    _WD_CapabilitiesAdd('w3c', True)
    Local $sPath = _WD_GetBrowserPath("msedge.exe")
    If $sPath Then _WD_CapabilitiesAdd("ie.edgepath", $sPath)
    _WD_CapabilitiesAdd("ie.edgechromium", True)
    _WD_CapabilitiesAdd("ignoreProtectedModeSettings", True)
    _WD_CapabilitiesAdd("initialBrowserUrl", "URL")
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')
    _WD_CapabilitiesDump(@ScriptLineNumber)
    Local $sCapabilities = _WD_CapabilitiesGet()
    Return $sCapabilities
EndFunc   ;==>SetupEdgeIEMode

 

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
×
×
  • Create New...