Jump to content

Passed in Google Chrome 131.0+chromedriver 131.0 + au3WebDriver-1.4.0, But How to use Google Chrome for Testing 131.0?


Recommended Posts

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

$bHeadless = False
$sCapabilities = SetupChrome($bHeadless)
If @error Then MsgBox(0, @error, @extended)
Local $iWebDriver_PID = _WD_Startup()
$sSession = _WD_CreateSession($sCapabilities)
_WD_Navigate($sSession, 'https://www.baidu.com')
_WD_LoadWait($sSession)
MsgBox(0,"","OK")

Func SetupChrome($bHeadless)
    _WD_Option('Driver', 'chromedriver.exe')
    Local $iPort = _WD_GetFreePort(5555, 5600)
;~  If @error Then Return SetError(@error, @extended, 0)
    _WD_Option('Port', $iPort)
    _WD_Option('DriverParams', '--port=' & $iPort & ' --verbose --log-path="' & @ScriptDir & '\chrome.log"')
;~  Local $sCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}'
    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'chrome')
    _WD_CapabilitiesAdd('w3c', True)
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')
    If $bHeadless Then _WD_CapabilitiesAdd('args', '--headless')
    _WD_CapabilitiesDump(@ScriptLineNumber) ; dump current Capabilities setting to console - only for testing in this demo
    Local $sCapabilities = _WD_CapabilitiesGet()
    Return $sCapabilities
EndFunc   ;==>SetupChrome

Google Chrome 131.0.6778.70
chromedriver    131.0.6778.69
au3WebDriver-1.4.0

Google Chrome for Testing 131.0.6778.69 ,install dir is d:\gct131\chrome.exe

The format of "binary=". And Testing port?

Link to comment
Share on other sites

51 minutes ago, Danp2 said:

Are you sure? What error did you receive?

Also, take a look at SetupGecko in wd_demo for an example of using _WD_GetBrowserPath and _WD_CapabilitiesAdd to set the executable path.

sure,It won't work if you copy the original, After changing \\to//, it can run normally.

$chromeLOC="C:\111\222\chrome.exe"
.......
_WD_CapabilitiesAdd('w3c', True)
_WD_CapabilitiesAdd('binary',$chromeLOC)

Of course, the best way is change the code to this.

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