Jump to content

Recommended Posts

Posted

Does the webdriver still work? 

Just tried launching and I get this console output and screenshot(attached pic).

Chrome does not launch. 

_WD_Option ==> Success [0] : Parameters:   Option=Port   Value=9515
_WD_Option ==> Success [0] : Parameters:   Option=DriverParams   Value=--log-path="H:\Quality Assurance\AutoIT Scripts\Know Your Client\Framework\chrome.log"
_WD_GetFreePort ==> Success [0 / 9515] : Parameters:   MinPort=9515   MaxPort=Default
_WD_IsLatestRelease ==> Success [0] : True
_WD_Startup: OS:    WIN_11 X64 26200 
_WD_Startup: AutoIt:    3.3.16.0
_WD_Startup: Webdriver UDF: 1.5.0 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.2
_WD_Startup: Driver:    H:\\Quality Assurance\\WebDriverUDF\\chromedriver.exe (64 Bit)
_WD_Startup: Params:    --log-path="H:\Quality Assurance\AutoIT Scripts\Know Your Client\Framework\chrome.log"
_WD_Startup: Port:  9515
_WD_Startup: Command:   "H:\\Quality Assurance\\WebDriverUDF\\chromedriver.exe" --log-path="H:\Quality Assurance\AutoIT Scripts\Know Your Client\Framework\chrome.log" 
_WD_Startup ==> Success [0]
__WD_Post ==> Send / Recv error [6] : HTTP status = 0
_WD_CreateSession ==> Webdriver Exception [10]
__WD_Delete ==> Send / Recv error [6] : HTTP status = 0
_WD_DeleteSession ==> Webdriver Exception [10] : Error occurs when trying to delete session
>Exit code: 0

My script is below. It's a bit complex as I create a GUI to be ran but essentially the only function ran once the Chrome driver is launched is

 _WD_Navigate($sSession, 'www.google.com/')

I'm using the chrome.exe version 152 and the version 152 of the chromedriver.exe 

;/******************************************************************************************/
;Generic Functions
#include <H:\Quality Assurance\GenericFunctions\GenericFunctions.au3>
;/******************************************************************************************/

;/******************************************************************************************/
;Test includes
#include <H:\Quality Assurance\AutoIT Scripts\App\Framework\Tests\WebDriver_Regression.au3>

#include <H:\Quality Assurance\AutoIT Scripts\Windows Automation\Framework\WindowsFunctions\Functions_Windows.au3>

#include <H:\Quality Assurance\WebDriverUDF\wd_core.au3>
#include <H:\Quality Assurance\WebDriverUDF\wd_helper.au3>
#include <H:\Quality Assurance\WebDriverUDF\Json.au3>
#include <H:\Quality Assurance\WebDriverUDF\WinHttp.au3>
#include <H:\Quality Assurance\WebDriverUDF\WinHttpConstants.au3>

#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
;/******************************************************************************************/
Global $AttemptIfStatement_MouseClicks = false ; if set to false it will not attempt the backup if statement on function WebDriver_Test_Xpath() under GenericFunctions.au3

$tTime = _Date_Time_GetSystemTime()
$TestResultstextLocation = "H:\Quality Assurance\AutoIT Scripts\App\Results" & ".csv" ; Open filecomman - deleting any existing content
Global $TestResults = FileOpen($TestResultstextLocation, $FO_OVERWRITE)

$TestLogLocation = "H:\Quality Assurance\AutoIT Scripts\Log\Log.txt" ; Open file - deleting any existing content
Global $TestLog = FileOpen($TestLogLocation, $FO_OVERWRITE)


Local Const $sElementSelector = "//input[@name='q']"

Local $sDesiredCapabilities, $iIndex, $sSession
Local $nMsg, $lProcess = False

Local $aBrowsers[][2] = [["Chrome", SetupChrome], _
                        ["Firefox", SetupGecko], _
                        ["Edge", SetupEdge]]

Local $aDemoSuite[][2] = [["WebTests", True], _
                        ["RegressionTests", False], _
                        ["OfficeTests", False], _
                        ["VLC", False], _
                        ["Collections", False], _
                        ["Integrations", False], _
                        ["SmokeTestIntegrations", False], _
                        ["Smoke_Customisations", False], _
                        ["CheckCreation", False], _
                        ["RunBillingWipReport", False]]

Local $aDebugLevel[][2] = [["None", $_WD_DEBUG_None], _
                            ["Error", $_WD_DEBUG_Error], _
                            ["Full", $_WD_DEBUG_Info]]

Local $iSpacing = 50
Local $iCount = UBound($aDemoSuite)
Local $aCheckboxes[$iCount]

Local $hGUI = GUICreate("iTrent Testing", 200, 150 + (20 * $iCount), 100, 200, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))

GUICtrlCreateLabel("Browser", 15, 12)
Local $idBrowsers = GUICtrlCreateCombo("", 75, 10, 100, 20, $CBS_DROPDOWNLIST)
Local $sData = _ArrayToString($aBrowsers, Default, Default, Default, "|", 0, 0)
GUICtrlSetData($idBrowsers, $sData)
GUICtrlSetData($idBrowsers, $aBrowsers[0][0])

GUICtrlCreateLabel("3e testing Functions", 15, 52)
For $i = 0 To $iCount - 1
    $aCheckboxes[$i] = GUICtrlCreateCheckbox($aDemoSuite[$i][0], 70, $iSpacing + (20 * $i), 100, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_PUSHLIKE))
    If $aDemoSuite[$i][1] Then GUICtrlSetState($aCheckboxes[$i], $GUI_CHECKED)
Next

Local $iPos = $iSpacing + 20 * ($iCount + 1)
WriteToConsoleAndLog("Error: Winactivate Outlook window > Mouse click the New email icon > Can't activate window")
GUICtrlCreateLabel("Debug", 15, $iPos + 2)
Local $idDebugging = GUICtrlCreateCombo("", 75, $iPos, 100, 20, $CBS_DROPDOWNLIST)
$sData = _ArrayToString($aDebugLevel, Default, Default, Default, "|", 0, 0)
GUICtrlSetData($idDebugging, $sData)
GUICtrlSetData($idDebugging, "Full")
Local $idButton = GUICtrlCreateButton("Run Regression!", 60, $iPos + 40, 85, 25)

GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idBrowsers

            Case $idDebugging

            Case $idButton
                $lProcess = True
                ExitLoop

           Case Else
                For $i = 0 To $iCount - 1
                    If $aCheckboxes[$i] = $nMsg Then
                        $aDemoSuite[$i][1] = Not $aDemoSuite[$i][1]
                        ExitLoop

                    EndIf

                Next
        EndSwitch
    WEnd

; Set debug level
$_WD_DEBUG = $aDebugLevel[_GUICtrlComboBox_GetCurSel($idDebugging)][1]

; Execute browser setup routine for user's browser selection
Call($aBrowsers[_GUICtrlComboBox_GetCurSel($idBrowsers)][1])

GUIDelete($hGUI)
If Not $lProcess Then Exit

_WD_Startup()


If @error <> $_WD_ERROR_Success Then
    Exit -1
EndIf

$sSession = _WD_CreateSession($sDesiredCapabilities)

If @error = $_WD_ERROR_Success Then
    For $iIndex = 0 To UBound($aDemoSuite, $UBOUND_ROWS) - 1
        If $aDemoSuite[$iIndex][1] Then
            ConsoleWrite("+Running: " & $aDemoSuite[$iIndex][0] & @CRLF)
            Call($aDemoSuite[$iIndex][0])

            ConsoleWrite("+Finished: " & $aDemoSuite[$iIndex][0] & @CRLF)
        Else
            ConsoleWrite("Bypass: " & $aDemoSuite[$iIndex][0] & @CRLF)
        EndIf
    Next
EndIf

MsgBox($MB_ICONINFORMATION, "Testing complete!", "Click ok to shutdown the browser and console")

_WD_DeleteSession($sSession)
_WD_Shutdown()


Func WebTests()

 _WD_Navigate($sSession, 'www.google.com/')

;---------------------------------------------------------------------------------------------------

;---------------------------------------------------------------------------------------------------
;Wait for page
_WD_LoadWait($sSession, 8000)

EndFunc

Func RegressionTests()

EndFunc

Func OfficeTests()
MsgBox($MB_SYSTEMMODAL, '', "The Date is:" & _NowDate())


EndFunc


Func VLC()

EndFunc

Func AdobeReader()

EndFunc

Func Integrations()

EndFunc

Func SmokeTestIntegrations()


EndFunc

Func Smoke_Customisations()


EndFunc

Func DemoDownload()
    
EndFunc

Func DemoWindows()

EndFunc

Func SetupGecko()
_WD_Option('Driver', 'geckodriver.exe')
_WD_Option('DriverParams', '--log trace')
_WD_Option('Port', 4444)

$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc

Func SetupChrome()
_WD_Option('Driver', 'H:\\Quality Assurance\\WebDriverUDF\\chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"H:\\Quality Assurance\\WebDriverUDF\\chrome.exe" }}}}'

EndFunc

Func SetupEdge()
;_WD_Option('Driver', 'MicrosoftWebDriver.exe')
_WD_Option('Driver', 'H:\\Quality Assurance\\WebDriverUDF\\msedgedriver.exe')
_WD_Option('Port', 17556)
_WD_Option('DriverParams', '--verbose')

$sDesiredCapabilities = '{"capabilities":{}}'
EndFunc

 

Screenshot 2026-09-11 111115.png

Posted
1 minute ago, Nine said:

Tested it with version 153 of Google Chrome and it is working just fine for me.

You seem to have forgotten to put --port on DriverParams

(untested your code)

Thanks for looking at

that would be covered by the line 

_WD_Option('Port', 9515)

no? 

Can you paste your barebones script with just a Navigate command for the webdriver here and I'll give your code a go? 

Posted

Not anymore.  Try this basic setup :

Func SetupChrome()
  _WD_Option('Driver', 'chromedriver.exe')
  _WD_Option('Port', 9515)
  _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"')
  Return '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"]}}}}'
EndFunc   ;==>SetupChrome

 

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