Jump to content

Recommended Posts

Posted
#include-once
#include "wd_helper.au3"
#include "wd_capabilities.au3"

_Example()

Func _Example()
    
    _WD_Option('Driver', @ScriptDir & '\' & 'IEDriverServer.exe')
    _WD_Option('DriverParams', '--log trace ')
    _WD_Option('Port', 5555)
    Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": { "se:ieOptions" : { "ie.edgepath":"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", "ie.edgechromium":true, "ignoreProtectedModeSettings":true }}}}'
    $iWDPid = _WD_Startup()
    $WD_SESSION = _WD_CreateSession($sDesiredCapabilities)

    ; wait for loading process ends
    _WD_LoadWait($WD_SESSION, 1000)
    If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's
    
    #Region ; Clean Up

        ; on the end session should be deleted
        _WD_DeleteSession($WD_SESSION)
        If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's

        ; and driver should be closed
        _WD_Shutdown()
        If @error Then Return SetError(@error, @extended, 0) ; always remember to check and handle error's

    #EndRegion ; Clean Up

EndFunc   ;==>_Example

IE mode With "IEDriverServer"

 

_WD_Navigate not work

  • Moderators
Posted

Parsix,

This is not an "example" so it had been moved from the "WebDriver Examples" thread.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)
#include-once
#include "wd_helper.au3"
#include "wd_capabilities.au3"

_Browse_In_IEMode_Example()
MsgBox(16,"Test", "Test")


Func _Browse_In_IEMode_Example()
    Local $WD_SESSION = _RunIEMode_("https://showip.net" , Default, True, True)
    _WD_DeleteSession($WD_SESSION)
    If @error Then Return SetError(@error, @extended, 0) 
    _WD_Shutdown()
    If @error Then Return SetError(@error, @extended, 0)
EndFunc


Func _RunIEMode($URL=Default , $IEDriver=Default, $bHeadless=True,$bDebug=false)

    Switch $IEDriver
        Case Default
            $IEDriver = @ScriptDir & '\' & 'IEDriverServer.exe'
    EndSwitch
    If Not FileExists($IEDriver) Then Return 0

    Switch $URL
        Case Default
            $URL = "https://showip.net/"
    EndSwitch

    _WD_Option('Driver', @ScriptDir & '\' & 'IEDriverServer.exe')
    _WD_Option('DriverParams', '--verbose --log trace ')
    _WD_Option('Port', 5555)
    If Not $bDebug then $_WD_DEBUG = $_WD_DEBUG_None ;_WD_ConsoleVisible(False)

    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'msedgeie')
    _WD_CapabilitiesAdd('w3c', True)
    ;_WD_CapabilitiesAdd('acceptInsecureCerts', True)
    Local $sPath =  _WD_GetBrowserPath("msedge")
    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')
    If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless')

    If Not $bDebug then _WD_CapabilitiesDump(@ScriptLineNumber)
    Local $sDesiredCapabilities = _WD_CapabilitiesGet()

    $iWDPid = _WD_Startup()
    Local $WD_SESSION = _WD_CreateSession($sDesiredCapabilities)
    Return $WD_SESSION
EndFunc

it run Edge in IE Mode

1 - that not run in kiosk mode

2 - that not run in Maximize

3 - After calling the example function, the command after the example function will not be executed until the opened browser window is closed.

4- Navigate not work

 

The following have been attempted: (not worked)

1 -

a. try 1

_WD_CapabilitiesAdd('excludeSwitches', '--kiosk --edge-kiosk-type=public-browsing --kiosk-idle-timeout-minutes=0')

b. try 2

_WD_CapabilitiesAdd('args', '--kiosk')
 _WD_CapabilitiesAdd('args', '--edge-kiosk-type=public-browsing')

 

2 -

a. try1

_WD_CapabilitiesAdd('args', " --start-maximized")

b. try2

_WD_CapabilitiesAdd('excludeSwitches', " --start-maximized")

c. try3

_WD_Window($WD_SESSION, "maximize")

 

4. error if use _WD_Navigate()

_WD_Option ==> Success [0] : Parameters:   Option=Driver   Value=E:\0-Dev-Projects\0-TestArea\webdriver\test1\IEDriverServer.exe
_WD_Option ==> Success [0] : Parameters:   Option=DriverParams   Value=--verbose --log trace 
_WD_Option ==> Success [0] : Parameters:   Option=Port   Value=5555
_WD_CapabilitiesAdd ==> Success [0] : Successfully used [alwaysMatch]  with specified browser: msedgeie
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = w3c     $value1 = true     $value2 = 
_WD_GetBrowserPath ==> Success [0 / 3] : Parameters:    Browser=msedge
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = ie.edgepath     $value1 = C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe     $value2 = 
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = ie.edgechromium     $value1 = true     $value2 = 
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = ignoreProtectedModeSettings     $value1 = true     $value2 = 
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = initialBrowserUrl     $value1 = https://showip.net     $value2 = 
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = excludeSwitches     $value1 = enable-automation     $value2 = 
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability:      $key = args     $value1 = --headless     $value2 = 
_WD_GetFreePort ==> Success [0 / 5555] : Parameters:   MinPort=5555   MaxPort=Default
_WD_IsLatestRelease ==> Success [0] : True
_WD_Startup: OS:    WIN_10 X64 19045 
_WD_Startup: AutoIt:    3.3.18.0
_WD_Startup: Webdriver UDF: 1.5.0 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.2
_WD_Startup: Driver:    E:\0-Dev-Projects\0-TestArea\webdriver\test1\IEDriverServer.exe (32 Bit)
_WD_Startup: Params:    --verbose --log trace 
_WD_Startup: Port:  5555
_WD_Startup: Command:   "E:\0-Dev-Projects\0-TestArea\webdriver\test1\IEDriverServer.exe" --verbose --log trace  
_WD_Startup ==> Success [0]
__WD_Post ==> Send / Recv error [6] : HTTP status = 0
_WD_CreateSession ==> Webdriver Exception [10]
__WD_Post ==> Unknown Command [18] : HTTP status = 405
_WD_Navigate ==> Unknown Command [18] : Parameters:   URL=https://google.com
__WD_Delete ==> Success [0] : HTTP status = 200
_WD_DeleteSession ==> Success [0] : WebDriver session deleted

 

Edited by Parsix

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...