Jump to content

WebDriver UDF (W3C compliant version) - 2024/09/21


Danp2
 Share

Recommended Posts

@samibb That's nice. Did you have a question? FWIW --

6 minutes ago, samibb said:

_WD_Startup: WinHTTP:    1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)

This information is here to assist you, so you should do as it says. 😉

8 minutes ago, samibb said:

_WD_Action ==> Invalid data type [3] : (Actions|Back|Forward|Refresh|Title|Url) $sCommand=>default

This is coming from somewhere else in your code that you didn't post.

Link to comment
Share on other sites

@Danp2

google chrome version 129 ......71 64bit

i have got $sCapabilities No.

but i could not find the element.

how to solve ?

Thanks 

 

Func SetupChrome();$bHeadless)
    $bHeadless = True
    _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"')

'i was using"
    ; $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}'


     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


"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" /ErrorStdOut "C:\Users\HP\Desktop\AutoIt\chrom_driver.au3"    
_WD_Option ==> Success [0] : Parameters:   Option=Driver   Value=chromedriver.exe
_WD_GetFreePort ==> Success [0 / 5555] : Parameters:   MinPort=5555   MaxPort=5600
_WD_Option ==> Success [0] : Parameters:   Option=Port   Value=5555
_WD_Option ==> Success [0] : Parameters:   Option=DriverParams   Value=--port=5555 --verbose --log-path="C:\Users\HP\Desktop\AutoIt\chrome.log"
_WD_CapabilitiesAdd ==> Success [0] : Successfully used [alwaysMatch]  with specified browser: chrome
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesAdd ==> Success [0] : Successfully added capability
_WD_CapabilitiesDump: JSON structure starts below: 174
{
    "capabilities":{
        "alwaysMatch":{
            "goog:chromeOptions":{
                "w3c":true,
                "excludeSwitches":[
                    "enable-automation"
                ],
                "args":[
                    "--headless"
                ]
            }
        }
    }
}
_WD_CapabilitiesDump: JSON structure ends above.
_WD_GetFreePort ==> Success [0 / 5555] : Parameters:   MinPort=5555   MaxPort=Default
_WD_IsLatestRelease ==> Success [0] : True
_WD_Startup: OS:    WIN_11 X64 22631 
_WD_Startup: AutoIt:    3.3.16.1
_WD_Startup: Webdriver UDF: 1.4.0 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.1 (Download latest source at <https://raw.githubusercontent.com/dragana-r/autoit-winhttp/master/WinHttp.au3>)
_WD_Startup: Driver:    chromedriver.exe (64 Bit)
_WD_Startup: Params:    --port=5555 --verbose --log-path="C:\Users\HP\Desktop\AutoIt\chrome.log"
_WD_Startup: Port:  5555
_WD_Startup: Command:   "chromedriver.exe" --port=5555 --verbose --log-path="C:\Users\HP\Desktop\AutoIt\chrome.log" 
_WD_Startup ==> Success [0]
$sCapabilities : {
    "capabilities":{
        "alwaysMatch":{
            "goog:chromeOptions":{
                "w3c":true,
                "excludeSwitches":[
                    "enable-automation"
                ],
                "args":[
                    "--headless"
                ]
            }
        }
    }
}
__WD_Post ==> Success [0] : HTTP status = 200
_WD_CreateSession ==> Success [0] : 5743c66263da0eb9945afd29d060d2ff
$sSession : 5743c66263da0eb9945afd29d060d2ff
***********************************************************************************************************
Starting ChromeDriver 129.0.6668.70 (df87d5cf12b1397be7495a04cab2db6239b227a8-refs/branch-heads/6668@{#1420}) on port 5555
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 5555.

DevTools listening on ws://127.0.0.1:61114/devtools/browser/be3b99c3-f5c0-4d0f-93f2-ebbc66c8b025
Created TensorFlow Lite XNNPACK delegate for CPU.

 

Edited by samibb
add
Link to comment
Share on other sites

No reason to SHOUT. There could be several potential causes --

  • Chrome -- You could test with a different browser
  • Website -- The format could have changed making your script outdated

If you want further assistance with this, then you should post a short "reproducer" script that we can run to observe the issue. If you are unable to do this, then the only other advice that I have is to stop running in a headless browser so that you can actually see what is occurring.

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

×
×
  • Create New...