Jump to content

Recommended Posts

Posted (edited)
  On 5/14/2023 at 11:34 PM, Danp2 said:

Try it like this --

_WD_CapabilitiesAdd('args', "user-data-dir=C:\\Users\\" & @UserName & "\\AppData\\Local\\Google\\Chrome\\User Data")
Expand  

Why you use duplicated backslashes ? From my experience: the JSON will be put to WebDriver and will be changed internally by UDF. If I'm wrong please explain.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 2 weeks later...
  • 2 weeks later...
Posted (edited)

Hi all,

Is there a way for the webdriver UDF to determine when the chromedriver is too new for the installed version of Chrome. Meaning so a message box will display "Please Update Your Version of Chrome"

I get an error 10 using:

 

$sSession = _WD_CreateSession($sDesiredCapabilities)
    If @error Then MsgBox( $MB_ICONWARNING, "Error Creating Session", $_WD_ERROR_Exception)

 

I see this in the debug info but not sure how to extract the more specific information about the error to a variable that I can use in the gui:

 

_WD_CreateSession: {"value":{"error":"session not created","message":"session not created: This version of ChromeDriver only supports Chrome version 114\nCurrent browser version is 113.0.5672.129 with binary path C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0043A813+48355]\n\t(No symbol) [0x003CC4B1]\n\t(No symbol) [0x002D5358]\n\t(No symbol) [0x002F61AC]\n\t(No symbol) [0x002F1EF3]\n\t(No symbol) [0x002F0579]\n\t(No symbol) [0x00320C55]\n\t(No symbol) [0x0032093C]\n\t(No symbol) [0x0031A536]\n\t(No symbol) [0x002F82DC]\n\t(No symbol) [0x002F93DD]\n\tGetHandleVerifier [0x0069AABD+2539405]\n\tGetHandleVerifier [0x006DA78F+2800735]\n\tGetHandleVerifier [0x006D456C+2775612]\n\tGetHandleVerifier [0x004C51E0+616112]\n\t(No symbol) [0x003D5F8C]\n\t(No symbol) [0x003D2328]\n\t(No symbol) [0x003D240B]\n\t(No symbol) [0x003C4FF7]\n\tBaseThreadInitThunk [0x75D1FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x776B7BBE+286]\n\tRtlGetAppContainerNamedObjectPath [0x776B7B8E+238]\n"}}

Thanks!

Edited by NassauSky
Posted
  On 6/5/2023 at 6:36 PM, Danp2 said:

I think that we could enhance _WD_UpdateDriver so that it will optionally downgrade the webdriver

Expand  

@Danp2 for such reason I asked it here:

https://github.com/Danp2/au3WebDriver/pull/477#issuecomment-1574798767

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Thanks @Danp2

Nice to have that new feature and I don't know if that would help in my situation but I'll have to think about how I can use that.  My app is on a server. When one of the users update their Chrome Browser, the script updates the ChromeDriver on the server and then all the other users who still have an old browser installed can no longer run the app.  I don't think it makes sense to ask Autoit to put an older version in the server.

As far as the nice GitHub update you made, for now I tested the code by uninstalling my newer chrome and installing an older chrome.   Something still might be wrong with the output. I left notes in GitHub.  Basically it doesn't seem to be reading the current version of the chromedriver.exe I have installed yet for some reason it seems to be displaying the Chrome Browser version where it says driver version. 

Edited by NassauSky
Posted

Great @Danp2

Looks good I tested your updated code again.

The update looks good and it does downgrade the chromedriver.exe using information from the correct directory if necessary.

#include ".\Required\wd_helper.au3"
#include ".\Required\wd_core.au3"

$sBrowser = 'chrome'
$bResult = _WD_UpdateDriver($sBrowser, @ScriptDir & ".\Required", Default, True, True) ;Last 2 params Force update, Force downgrade
;### Debug CONSOLE ↓↓↓
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bResult = ' & $bResult & @CRLF & '>Error code: ' & @error & @CRLF)

;--- Test the downgrade

Global $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", "goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"],' & _
                        '"useAutomationExtension": false, "prefs": {"credentials_enable_service": false}, "args": ["window-size='&@DesktopWidth-900&','&@DesktopHeight-34&'","window-position=500,0"] }}}}'

_WD_Option('Driver', '.\Required\chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\Required\chrome.log"')
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
If @error Then
   MsgBox( $MB_TOPMOST, "Error Creating Session... Exiting", "Check your debug logs")
   Exit
EndIf
_WD_Navigate($sSession,"https://www.google.com")


 

Posted

image.png.2e786e4ad945adf23163b6679aeff240.png

I have that, how to turn off password saver?

I use Chrome and my setup here:

Func _SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args": [ ' & """start-maximized""," & " ""disable-infobargs""" & "" & '], "excludeSwitches": ["enable-automation"]}}}}'
    Return $sCapabilities
EndFunc

 

Posted
  On 6/14/2023 at 3:51 AM, iSan said:

how to turn off password saver?

Expand  

https://allaboutcookies.org/how-to-turn-off-google-password-manager

https://stackoverflow.com/a/46602329/5314940

https://sqa.stackexchange.com/a/26515/14581

 

_WD_CapabilitiesAdd('prefs', 'credentials_enable_service', False)     ; https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-12272021/?do=findComment&comment=1464829
    _WD_CapabilitiesAdd('prefs', 'profile.password_manager_enabled', False)     ; https://sqa.stackexchange.com/a/26515/14581

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 6/14/2023 at 3:51 AM, iSan said:

I use Chrome and my setup here:

Func _SetupChrome()
    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
    $sCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args": [ ' & """start-maximized""," & " ""disable-infobargs""" & "" & '], "excludeSwitches": ["enable-automation"]}}}}'
    Return $sCapabilities
EndFunc
Expand  

Take a look at wd_demo.au3 and start using _WD_Capabilities*() functions.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/14/2023 at 7:03 AM, mLipok said:

Take a look at wd_demo.au3 and start using _WD_Capabilities*() functions.

Expand  

I'm noob. I tryed to use _WD_Capabilities*() functions but do not work, but when i use $sCapabilities for SetupChrome that works 😅

Posted (edited)

btw.
I encourage you to watch: https://github.com/mlipok/Au3WebDriver-testing

EDIT1:
There is modified "maximized"

Func SetupChrome($bHeadless, $s_Download_dir = '', $bLogToFile = False)

EDIT2:
I just rename this function on my GitHub repro.

Func _WD_SetupChrome($bHeadless, $s_Download_dir = '', $bLogToFile = False)

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...