Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

3 minutes ago, Danp2 said:

@sylremoHave you tried using multiple sessions with a single instance of Chromedriver?

I did try to create 2 session with a single chromedriver instance but when creating 2nd session, calling _WD_CreateSession didnt return anything although it did open a new chrome window.

Link to comment
Share on other sites

Howdy,

how can I access the parent node of a selected node and additional with a negotation condition in XPath?

My example doesn't work because it's not a valid Syntax, I guess I'm using the ".." and "not()" wrong 🤦‍♂️

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//p['Place bet']..button[not(@disabled)]")


The pointed Element is what I want to find (NOTE: class & dashlane-rid attribute get always random generated values, not useable)
image.thumb.png.4b0ad31a4f233211005a4d1e0b8d08ca.png

Link to comment
Share on other sites

If somebody is interested in here is the solution how to use parent axis "::" and negation "not()"
 

_WD_FindElement($mySession, $_WD_LOCATOR_ByXPath, "//p[text()='Place bet']/parent::button[not(@disabled)][@color='green']")

Google is still my best friend 😄

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 03/28/2022

Latest update just released. See below for change log.

Quote

## [0.8.0] - 2022-03-28

### Added

- _WD_Option: Support for "ConsoleSuffix", "ErrorMsgbox", "OutputDebug", and "Version" options
- _WD_ElementSelectAction: Added Multiselect functionality

### Changed

- __WD_ConsoleWrite: Utilize new ConsoleSuffix setting
- __WD_Error: Refactored for improved functionality
- _WD_CapabilitiesDump: Adhere to debug level settings
- _WD_Startup: Additional logging when error detected

### Fixed

- _WD_Startup: Display of webdriver bit level (32 / 64)
- _WD_UpdateDriver: Set @extended correctly
- _WD_GetBrowserVersion: Binary type checking
- _WD_Cookies: Deletion corrected
- wd_capabilities: Validate initialization result
- wd_demo: Updated routines to ensure proper functionality

### Project

- Scripts should use _WD_LastHTTPResult() to obtain the result of the most recent HTTP request as Webdriver functions no longer set @extended to last HTTP request result.
- Improved logging / error reporting by making sure that functions call __WD_Error.

 

Link to comment
Share on other sites

I am using _WD_PrintToPdf and trying to make the created PDF just one whole page containing everything,  I checked https://www.w3.org/TR/webdriver/#print-page and tried with page width and height, scale and shrinkToFit but not working well for me

;~      $pdfPrint = _WD_PrintToPdf($sSession,'{"scale":0.5}')
;~      $pdfPrint = _WD_PrintToPdf($sSession, '{"shrinkToFit":false}')
;~      $pdfPrint = _WD_PrintToPdf($sSession, '{"orientation":"landscape"}')
        $pdfPrint = _WD_PrintToPdf($sSession, '{"page": { "width": 1000, "height": 2000}}')
;~      $pdfPrint = _WD_PrintToPdf($sSession)

Is there such a parameter as pagesize? And can i set it to just fit the whole result in one page?

Link to comment
Share on other sites

34 minutes ago, Moonscarlet said:

 

;~      $pdfPrint = _WD_PrintToPdf($sSession,'{"scale":0.5}')
;~      $pdfPrint = _WD_PrintToPdf($sSession, '{"shrinkToFit":false}')
;~      $pdfPrint = _WD_PrintToPdf($sSession, '{"orientation":"landscape"}')
        $pdfPrint = _WD_PrintToPdf($sSession, '{"page": { "width": 1000, "height": 2000}}')
;~      $pdfPrint = _WD_PrintToPdf($sSession)

And can i set it to just fit the whole result in one page?

I answer in next few hour when I come to my laptop.

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:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

1 hour ago, Moonscarlet said:

Is there such a parameter as pagesize? And can i set it to just fit the whole result in one page?

you are lucky, that I solve this mystery few month ago....

 

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:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

btw.

in wd_demo.au3 there is DemoPrint()

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:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

@mLipokthanks, however, i am still facing the same problem, for example see this link

https://www.lumex.com/lcd-displays-character-20x2+20x4.html

Spoiler

image.thumb.png.9fe52f84e8b86d515c683de05e602a0d.png

 

using no options

$pdfPrint = _WD_PrintToPdf($sSession)

I got this pdf (which is divided into more pages and that "column" on the right was pushed below when it's supposed to be at the top right:

Spoiler

image.png.e90d5f1271f9f2cc99953ba1de4bb1b3.png

 

I tried the options you listed and got the same result:

$pdfPrint = _WD_PrintToPdf($sSession, '{"page":{"width":29.70,"height":42.00},"margin":{"top":2,"bottom":2,"left":2,"right":2},"scale":0.5,"orientation":"landscape","shrinkToFit":true,"background":true,"pageRanges":[1,"1-1"]}')

 

Spoiler

image.png.d3d054b5069eb645e83f1ed233e34a87.png

 

However, trying to print to pdf manually in the browser (CTRL+P) gives me:

Spoiler

image.png.5eea92ed9a3a2672aa113d6254e114b5.png

 

So, I am not really sure how to get it like that using the udf ;S

Maybe paper size? but i don't know how that would be possible

image.png.1777e82d257429f35bffa0e094dc9999.png

Link to comment
Share on other sites

Try to use:

#AutoIt3Wrapper_UseX64=N
#include "wd_helper.au3"
#include "wd_capabilities.au3"

_Example_2()

Func _Example_2()
;~  Local $sSession = _MY__WD_SetupFireFox(False)
    Local $sSession = _MY__WD_SetupChrome(True)
    If @error Then Return SetError(@error, @extended)

    _WD_Navigate($sSession, "https://www.lumex.com/lcd-displays-character-20x2+20x4.html")
    If @error Then
        _WD_Shutdown()
        Return
    EndIf

    ; https://www.w3.org/TR/webdriver/#print-page
    ; https://stackoverflow.com/a/68353518/5314940
    ; http://www.polger.wroclaw.pl/Formaty-papieru,51.html

    Local $s_JSON_PrintOptions = StringReplace( _ ; TABLOID 279.4 x 431.8 = https://www.engineeringtoolbox.com/office-paper-sizes-d_213.html
            '{' & _
            '   "page":{' & _
            '           "width": 27.94' & _
            '           ,"height": 43.18' & _
            '       }' & _
            '   ,"margin":{' & _
            '           "top": 0' & _
            '           ,"bottom": 0' & _
            '           ,"left": 0' & _
            '           ,"right": 0' & _
            '       }' & _
            '   ,"scale": 1.0' & _
            '   ,"orientation":"portrait"' & _
            '   ,"background": true' & _
            '   ,"pageRanges": ["1-10"]' & _
            '}', @TAB, '')


    Local $sFileFullPath = @ScriptDir & '\PackingSlip_1_A3.pdf'
    _Test($sSession, $s_JSON_PrintOptions, $sFileFullPath)
    _WD_Shutdown()
EndFunc   ;==>_Example_2

Func _Test($sSession, $sOptions, $sFileFullPath)
    Local $dBinaryDataToWrite = _WD_PrintToPdf($sSession, $sOptions)
    Local $hFile = FileOpen($sFileFullPath, $FO_OVERWRITE + $FO_BINARY)
    FileWrite($hFile, $dBinaryDataToWrite)
    FileClose($hFile)

    ShellExecute($sFileFullPath)
EndFunc   ;==>_Test

Func _MY__WD_SetupChrome($b_Headless = False, $s_Download_dir = '', $_WD_DEBUG_LEVEL = Default, $s_Log_FileFullPath = Null)
    If $_WD_DEBUG_LEVEL = Default Then
        $_WD_DEBUG = $_WD_DEBUG_Error
        If Not @Compiled Then $_WD_DEBUG = $_WD_DEBUG_Info
    EndIf

    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DefaultTimeout', 1000)

    _WD_UpdateDriver('chrome')
    If @error Then Return SetError(@error, @extended, '')

    #  !!! WARRNING !!!   AS DEFAULT DO NOT USE '--log-path=' BECAUSE OF   GDPR / RODO law rules
    If $s_Log_FileFullPath = Default Then
        Local $s_Default_Log_File = @ScriptDir & '\Log\' & @YEAR & @MON & @MDAY & '-' & @HOUR & @MIN & @SEC & ' WebDriver - Chrome - Testing.log'
        _WD_Option('DriverParams', '--log-path=' & '"' & $s_Default_Log_File & '"')
    ElseIf IsString($s_Log_FileFullPath) And StringLen($s_Log_FileFullPath) Then
        _WD_Option('DriverParams', '--log-path=' & '"' & $s_Log_FileFullPath & '"')
    EndIf

    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch')
    _WD_CapabilitiesAdd('acceptInsecureCerts', True)

    _WD_CapabilitiesAdd('firstMatch', 'chrome')
    _WD_CapabilitiesAdd('browserName', 'chrome')
    _WD_CapabilitiesAdd('w3c', True)
    _WD_CapabilitiesAdd('args', 'user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default')
    _WD_CapabilitiesAdd('args', 'user-agent', 'Mozilla/5.0 (Windows NT 10.0; Win' & StringReplace(@OSArch, 'X', '') & '; ' & @CPUArch & ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/' & _WD_GetBrowserVersion('chrome') & ' Safari/537.36')
    _WD_CapabilitiesAdd('args', '--profile-directory', Default)
    _WD_CapabilitiesAdd('args', 'start-maximized')
    _WD_CapabilitiesAdd('args', 'disable-infobars')
    _WD_CapabilitiesAdd('args', '--no-sandbox')
    _WD_CapabilitiesAdd('args', '--disable-blink-features=AutomationControlled')
    _WD_CapabilitiesAdd('args', '--disable-web-security')
    _WD_CapabilitiesAdd('args', '--allow-running-insecure-content') ; https://stackoverflow.com/a/60409220
    _WD_CapabilitiesAdd('args', '--ignore-certificate-errors') ; https://stackoverflow.com/a/60409220
    _WD_CapabilitiesAdd('prefs', 'credentials_enable_service', False) ; https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-12272021/?do=findComment&comment=1464829
    If $b_Headless Then _
            _WD_CapabilitiesAdd('args', '--headless')
    If $s_Download_dir Then _
            _WD_CapabilitiesAdd('prefs', 'download.default_directory', $s_Download_dir)
    _WD_CapabilitiesAdd('excludeSwitches', 'disable-popup-blocking') ; https://help.applitools.com/hc/en-us/articles/360007189411--Chrome-is-being-controlled-by-automated-test-software-notification
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')
    _WD_CapabilitiesAdd('excludeSwitches', 'load-extension')

    _WD_CapabilitiesDump(@ScriptLineNumber & ':WebDriver: testing')
    Local $s_Capabilities = _WD_CapabilitiesGet()

    _WD_Startup()
    If @error Then Return SetError(@error, @extended)

    Local $WD_SESSION = _WD_CreateSession($s_Capabilities)
    Return SetError(@error, @extended, $WD_SESSION)

EndFunc   ;==>_MY__WD_SetupChrome

Func _MY__WD_SetupFireFox($b_Headless, $s_Download_dir = '', $_WD_DEBUG_LEVEL = Default, $s_Log_FileFullPath = Null)
    If $s_Download_dir Then $s_Download_dir = StringReplace($s_Download_dir, '\', '\\')

    If $_WD_DEBUG_LEVEL = Default Then
        $_WD_DEBUG = $_WD_DEBUG_Error
        If Not @Compiled Then $_WD_DEBUG = $_WD_DEBUG_Info
    EndIf

    #  !!! WARRNING !!!   AS DEFAULT DO NOT USE '--log-path=' BECAUSE OF   GDPR / RODO law rules
    If $s_Log_FileFullPath = Default Then
        Local $s_Default_Log_File = @ScriptDir & '\Log\' & @YEAR & @MON & @MDAY & '-' & @HOUR & @MIN & @SEC & ' WebDriver - FireFox - Testing.log'
        _WD_Option('DriverParams', '--log-path=' & '"' & $s_Default_Log_File & '"')
    ElseIf IsString($s_Log_FileFullPath) And StringLen($s_Log_FileFullPath) Then
        _WD_Option('DriverParams', '--log-path=' & '"' & $s_Log_FileFullPath & '"')
    EndIf
    _WD_Option('Driver', 'geckodriver.exe')
;~  _WD_Option('DriverParams', '--log trace --marionette-port 2828')
    _WD_Option('Port', 4444)
    _WD_Option('DefaultTimeout', 1000)

    _WD_Startup()
    If @error Then Return SetError(@error, @extended, '')

    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch')
    _WD_CapabilitiesAdd('acceptInsecureCerts', True)
    _WD_CapabilitiesAdd('firstMatch', 'firefox')
;~  _WD_CapabilitiesAdd('args', '-profile')
;~  _WD_CapabilitiesAdd('args', @LocalAppDataDir & '\Mozilla\Firefox\Profiles\WD_Testing_Profile') ; CHANGE TO PROPER DIRECTORY PATH

    If $b_Headless Then _
            _WD_CapabilitiesAdd('args', '--headless')

    _WD_CapabilitiesDump(@ScriptLineNumber & ':WebDriver')
    Local $s_Capabilities = _WD_CapabilitiesGet()

    _WD_Startup()
    If @error Then Return SetError(@error, @extended)

    Local $WD_SESSION = _WD_CreateSession($s_Capabilities)
    Return SetError(@error, @extended, $WD_SESSION)

    Return SetError(@error, @extended, $WD_SESSION)
EndFunc   ;==>_MY__WD_SetupFireFox

 

switch between:
 

;~  Local $sSession = _MY__WD_SetupFireFox(False)
    Local $sSession = _MY__WD_SetupChrome(True)

It is issue with "chromedriver.exe"

https://bugs.chromium.org/p/chromium/issues/detail?id=1311166

 

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:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Hi,

I’m beginner with webdriver and I execute _WD_Navigate on an intranet url, but this intranet open a popup windows to ask a password key!

I want to handle this popup windows, but at this time the script is stopped because I think _WD_Navigate is waiting an HTTP response

 

 

_WD_Navigate($sSession, "https://opnjhg03-adm.rouen.xxzzz.fr:31943")
        ; >> here the script is stopped !
    if WinExists("Password Required") then; popup windows
        ; I will do somethink to handle the popup windows
    EndIf

 

 

There is an issue to solve this problem

Thanks a lot

FIREFOX Demande Password.jpg

Edited by tac7
Link to comment
Share on other sites

1 hour ago, tac7 said:

I want to handle this popup windows, but at this time the script is stopped because I think _WD_Navigate is waiting an HTTP response

This is normal proper behavior, due to security rules.
And this is not related to WebDriver at all, but it is related to Browser which do not release process till you provide your credentials.

Trying to bypasing this with AutoIt is possible but is not in line with forum rules.
Please do not ask again about how to solve this.

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:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

2 hours ago, mLipok said:

Trying to bypasing this with AutoIt is possible but is not in line with forum rules.
Please do not ask again about how to solve this.

I don't think that this is something we need to avoid, because it's an internal website and they're meant to reach this website normally. If they were to use the existing profile, the password would be properly provided to the website. This doesn't seem to bypass anything and instead implements the recommended security measures :)

Maybe I'm misunderstanding something and if so, please pm me to shut up :D

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 07/29/2022
  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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