Jump to content

WebDriver UDF - Help & Support (III)


Danp2
 Share

Recommended Posts

Hello All,
I want to open a FF Windows and a Second Windows and open a new tab in the second windows, but my code don't work.
 

Local $iWebDriver_PID = _WD_Startup()

$sSession = _WD_CreateSession($sCapabilities)
_WD_Navigate($sSession, "https://www.google.com/") ; >> Open the first windows

MsgBox(0, "", "")

$aHandleNewWindows = _WD_Window($sSession, 'new', '{"type":"window"}'); >> Open NEW Windows
_WD_Window($sSession, 'Switch', '{"handle":"' & $aHandleNewWindows & '"}') ; Swith on this the Windows
_WD_Navigate($sSession, "https://www.google.com/") ; Nagigate to google

MsgBox(0, "", "")

$aHandleNewtab = _WD_NewTab($sSession, True)    ; >> Open New Tab but on the First Windows and not the second !

It seems I don't understand the option 'switch' with _WD_Windows !?

Link to comment
Share on other sites

Hi Danp2, tanks a lot,

I'm losing my mind!!!

I did not work with FF but with Edge.

I confirm it's work Fine on FF but not on Edge. (I don't Have Chrome!)

 

>"C:\Applications\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Applications\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\My Program Files\Travail_Autoit\TEST (UDF-JSON - Firefox - Excel - Shell)\# Webdriver ouvre 2 fenetre & onglet\Webdriver ouvre 2 fenetre & onglet - 2022-06-07 pour forum.au3" /UserParams    
+>15:53:14 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0)  Keyboard:0000040C  OS:WIN_10/2009  CPU:X64 OS:X64  Environment(Language:040C)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Applications\AutoIt3\SciTE   UserDir => C:\Users\tuka7260\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\tuka7260\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Applications\AutoIt3  input:C:\My Program Files\Travail_Autoit\TEST (UDF-JSON - Firefox - Excel - Shell)\# Webdriver ouvre 2 fenetre & onglet\Webdriver ouvre 2 fenetre & onglet - 2022-06-07 pour forum.au3
+>15:53:15 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Applications\AutoIt3\autoit3_x64.exe "C:\My Program Files\Travail_Autoit\TEST (UDF-JSON - Firefox - Excel - Shell)\# Webdriver ouvre 2 fenetre & onglet\Webdriver ouvre 2 fenetre & onglet - 2022-06-07 pour forum.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
_WD_CapabilitiesAdd ==> Success (0) : Successfully used [alwaysMatch]  with specified browser: msedge
_WD_CapabilitiesAdd ==> Success (0) : Successfully added capability
_WD_CapabilitiesDump: JSON structure starts below: 232
{
    "capabilities":{
        "alwaysMatch":{
            "ms:edgeOptions":{
                "excludeSwitches":[
                    "enable-automation"
                ]
            }
        }
    }
}
_WD_CapabilitiesDump: JSON structure ends above.
_WD_IsLatestRelease ==> Success (0) : False
_WD_Startup: OS:    WIN_10 WIN32_NT 19042 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: Webdriver UDF: 0.9.0 (Update available)
_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:    msedgedriver.exe (64 Bit)
_WD_Startup: Params:    --verbose --log-path="C:\My Program Files\Travail_Autoit\TEST (UDF-JSON - Firefox - Excel - Shell)\# Webdriver ouvre 2 fenetre & onglet\msedge.log"
_WD_Startup: Port:  9515
_WD_Startup: Command:   "msedgedriver.exe" --verbose --log-path="C:\My Program Files\Travail_Autoit\TEST (UDF-JSON - Firefox - Excel - Shell)\# Webdriver ouvre 2 fenetre & onglet\msedge.log" 
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={
    "capabilities":{
        "alwaysMatch":{
            "ms:edgeOptions":{
                "excludeSwitches":[
                    "enable-automation"
                ]
            }
        }
    }
}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"msedge","browserVersion":"100.0...
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"msedge","browserVersion":"100.0.1185.60","ms:edgeOptions":{"debuggerAddress":"localhost:58676"},"msedge":{"msedgedriverVersion":"100.0.1185.44 (a485c16d1ab76394f5d7397e15c0d7583d5259c1)","userDataDir":"C:\\Users\\tuka7260\\AppData\\Local\\Temp\\1\\scoped_dir23872_902297193"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"55fa7d76c886033f58b846dd7e057d9c"}}
_WD_CreateSession ==> Success (0) HTTP status = 200
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/url; $sData={"url":"https://www.google.com/"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}...
_WD_Navigate ==> Success (0) HTTP status = 200 : {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window/new; $sData={"type":"window"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":{"handle":"CDwindow-4168F748ACB0D015C54859E66B36A61C","type":"window"}}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":{"handle":"CDwindow-4168F748ACB0D015C54859E66B36A61C","type":"window"}}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window; $sData={"handle":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/url; $sData={"url":"https://www.yahoo.fr/"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}...
_WD_Navigate ==> Success (0) HTTP status = 200 : {"value":null}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window
__WD_Get ==> Success (0) HTTP status = 200 : ResponseText={"value":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window; $sData={"handle":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window
__WD_Get ==> Success (0) HTTP status = 200 : ResponseText={"value":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":"CDwindow-4168F748ACB0D015C54859E66B36A61C"}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window/new; $sData={"type":"tab"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":{"handle":"CDwindow-3B4016546E4CC767E21C87FB9B0BEE45","type":"tab"}}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":{"handle":"CDwindow-3B4016546E4CC767E21C87FB9B0BEE45","type":"tab"}}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/55fa7d76c886033f58b846dd7e057d9c/window; $sData={"handle":"CDwindow-3B4016546E4CC767E21C87FB9B0BEE45"}
__WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}...
_WD_Window ==> Success (0) HTTP status = 200 :  : Response={"value":null}...
+>15:53:40 AutoIt3.exe ended.rc:0
+>15:53:40 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 26.7

 

Edited by tac7
Link to comment
Share on other sites

49 minutes ago, tac7 said:

_WD_Startup: Webdriver UDF: 0.9.0 (Update available)

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

There's a minor bug fix release available for the Webdriver UDF. More important, you should definitely update your copy of WinHttp.au3 to ensure proper functionality.

I didn't test Edge, but I would expect it to behave similarly to Chrome since they are both based on Chromium.

Edit: This modification appears to be a viable workaround --

$sHandleNewtab = _WD_NewTab($sSession, Default, Default, Default, "noreferrer")    ; >> Tab now opens on the correct window

 

Edited by Danp2
Link to comment
Share on other sites

On 5/31/2022 at 7:56 PM, ElPandaRojo1 said:

Hello, I would like to know if it is possible to take the screenshot of the page but complete it, example I want to capture a table, but this table is a bit long towards the bottom, and if I do it with the following function, it cuts it off since it is not displayed in display the entire table.

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='tablaPagina']/tbody/tr[2]")
$cResult = _WD_ElementAction($sSession, $sButton, "screenshot")

There is a possibility that I capture the total image that I want without having to move the scroll so that the image is not cropped.

I suppose that this
https://github.com/Danp2/au3WebDriver/pull/325/commits/5c23b9e4804d25a4af0b87ec59a1378fa8d14452

should be helpfull to you, especially:

; change the attributes of the frame to improve the visibility of the <select> element, on which the options will be indicated
    Local $sJavaScript = "var element = arguments[0]; element.setAttribute('height', '500'); element.setAttribute('padding', '0');"
    _WD_ExecuteScript($sSession, $sJavaScript, __WD_JsonElement($sFrame), Default, Default)
    If @error Then Return SetError(@error, @extended, ''

I suppose that you have element which have SCROLLBAR and you need to scroll it.
In this case, you should change the size attribute of such an element to make sure that the scroll bar is not needed because the contents of the resized element should be fully visible.

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

I have problem launching webdriver when running with proxifier (unable to start). If I turn off the proxifier it works fine

log

[1654764908.658][INFO]: Starting ChromeDriver 102.0.5005.61 (0e59bcc00cc4985ce39ad31c150065f159d95ad3-refs/branch-heads/5005@{#819}) on port 9515
[1654764908.658][INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

in this case what do i need to do

Link to comment
Share on other sites

40 minutes ago, BuiTuanAnh said:

running with proxifier

??

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 all,

Anyone have any tips how to disconnect and reconnect to a Chrome webdriver session in the same application? 

I successfully got re-attached to a Firefox session after calling a second application but first I want to do it within the same application and most important I want to use Chrome since I wrote a couple dozen applications sharing the same Chrome code.

Thanks for any help.

Edited by NassauSky
Link to comment
Share on other sites

@NassauSkyIt would be helpful if you provided a more detailed description explaining your scenario. For example --

  • Why do you need to perform the "reattach" in the first place?
  • Is the webdriver instance being reused or is it being closed then opened again?
  • What have you tried thus far?

P.S. Search the forum for the terms "remote-debugging-port" and "debuggerAddress"  should give you some ideas on how this can be done.

Link to comment
Share on other sites

Thanks @Danp2

1) I was clicking on a Javascript tab and then I lost connection to the session where I couldn't perform any xPath queries. It was driving me nuts for a while and what got me was that Chrome inspector allowed me to use the same queries I was using in my code successfully. I was also able to use inspector console to run the queries from Chrome inspector.  

2) I wanted to re-use the instance thinking I can reconnect to it (almost like a 15 second reset unplugging a device)  hoping that would resolve the issue.

3) Our Library uses Chrome on all the PC's so I really hesitated using Firefox but I got to the point where I had tested and modified some sample code which used used Firefox and got it to successfully reconnect to the existing instance after calling runwait from separate source.   My next step was combining the Firefox  main source with the 2nd source. I got this to work in where it creates a new $sSession variable as it reconnects to the same instance that was still running.

 

I apologize but my difficulty (and maybe others) using the  correct verbiage is an important factor in debugging. At times I just can't think of the correct words. In this case, re-connect vs re-attach and if I thought of the correct word 'attach' at the time I might have realized it might be a tab issue.  How many times I have been running this same project over and over again using Chrome and it was opening an actual Chrome tab just before clicking on the Javascript tab.

It seems to be more than that and I still am trying to see if I can use the same successful Firefox re-connect/re-attach method but in Chrome as mLipok shared that I used here: 

I'm going to try a few things now: 

A) Search the forum for the terms "remote-debugging-port" and "debuggerAddress"  (Thanks!)

B) Looking through mLipok's Firefox code to see if I can implement it in Chrome

C) Research if this

_WD_Option('DriverDetect', False) ; To ignore another instance of Chrome

has any bearing on reconnecting/attaching to an existing session in Chrome if I make the last parameter True

 

Only one employee at my job will be collecting stats from our server using this method so if I can't  get this working in Chrome, I'll just install Firefox on her PC and keep it updated. 

Thanks again @Danp2

Edited by NassauSky
Link to comment
Share on other sites

Func SetupChrome($bHeadless)
    Local $sChromeProfil = 'C:/Webdriver/CHROME_WD_Profile'
    Local $sLogsPath = 'c:\webdriver\'
    _WD_Option('Driver', $sWebDriverFileChrome)
    _WD_Option('Port', 9715)
    _WD_Option('DriverParams', '--verbose --log-path=' & $sLogsPath & 'chrome.log')
    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'chrome')
    _WD_CapabilitiesAdd('w3c', True)
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')
    _WD_CapabilitiesAdd('args', 'user-data-dir=' & $sChromeProfil)
    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

Hi Dan,

I have problems using a different profile ($sChromeProfil). Console shows 

"args":["user-data-dir=C:\/Webdriver\/CHROME_WD_Profile"  and __WD_Post ==> Send / Recv error (6) : ResponseText=WinHTTP request timed out before Webdriver... and _WD_CreateSession ==> Webdriver Exception (10)

What is wrong? Perhaps \ and / ? I tried both of them.

 

Link to comment
Share on other sites

23 minutes ago, Danp2 said:

@HJLHave you tried the example code from the wiki? It doesn't use the newer _WD_Capabilities functions, but you should be able to adapt it fairly easily.

Which one ?

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

Hi all & Dan,

What's the trick to getting Webdriver to wait until a page is fully loaded. This  example is of a website which has been giving me a problem all morning and maybe you can see it taking a while to load when you test this example (if you even have to test it since you might know why without testing)

 

   SplashTextOn('Notice', 'Loading Website ... ',500,150,default,default,33,'Arial',14)
        _WD_Navigate($sSession, 'https://www.tutorialspoint.com/html/html_frames.htm')
        _WD_LoadWait($sSession, 300,40000)
   SplashOff()

Before the 40 seconds it moves on but the page isn't fully loaded

 

Strange thing is that this doesn't seem to work right either (as far as I understand)

Func ExampleNoLoad()
    $iResult = 0
    HotkeySet ( "+{ESC}", "_Exit" ) ;+shift !alt ^ctrl #winkey
    $hTimer = TimerInit()
    SplashTextOn('Notice', 'Loading Website ... ',500,150,default,default,33,'Arial',14)
        _WD_Navigate($sSession, GUICtrlRead($XpathUrl))
        While $iResult = 0
            $iResult = _WD_LoadWait($sSession, 300,3000)
            ConsoleWrite("-Waiting " & Round(TimerDiff($hTimer)/1000,1) & @TAB & "Failed->" & @TAB & "$_WD_ERROR_Timeout=" & @error & @CRLF)
        WEnd
    SplashOff()
EndFunc ;==ExampleNoLoad
Func _Exit()
    ConsoleWrite("Started Func _Exit()" & @CRLF)
    _WD_DeleteSession($sSession)
    _WD_Shutdown()
    Exit
EndFunc   ;==>Exit

The above code loops and checks every 3 seconds for a _WD_LoadWait success but until that happens it prints out every timeout failure error to the console. Strange that it keeps displaying 0 as the timeout error yet the top left of chrome is still showing the tab is loading and it doesn't seem to make a difference or move forward after the tab loaded.

Thanks for all help and tips.

Edited by NassauSky
More info included
Link to comment
Share on other sites

@Danp2

Today question was asked here:

 

I start to wonder....
Could you explain how to use _WD_LoadWait() but with $sElement parameter ?

 

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

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