## Recommended Posts

Hi all,

I´m trying to use the command "WD_LoadWait" because I want to pause the script until the web page fully loads in Firefox but I don´t know how to use it.

Here´s the full help

 ; #FUNCTION# ====================================================================================================================
 ; Description ...: Wait for a browser page load to complete before returning
 ; Syntax ........: _WD_LoadWait($sSession[,$iDelay = 0[, $iTimeout = -1[,$sElement = '']]])
 ; Parameters ....: $sSession - Session ID from _WDCreateSession  ;$iDelay - [optional] Milliseconds to wait before checking status
 ; $iTimeout - [optional] Period of time to wait before exiting function  ;$sElement - [optional] Element ID to confirm DOM invalidation
 ; Return values .: Success - 1
 ; Failure - 0 and sets the @error flag to non-zero
 ; Author ........: Dan Pollak
 ; Modified ......:
 ; Remarks .......:
 ; Related .......:
 ; Example .......: No
 ; ===============================================================================================================================
 Func _WD_LoadWait($sSession,$iDelay = Default, $iTimeout = Default,$sElement = Default)
 Local Const $sFuncName = "_WD_LoadWait"  Local$iErr, $sResponse,$oJSON, $sReadyState  If$iDelay = Default Then $iDelay = 0  If$iTimeout = Default Then $iTimeout =$_WD_DefaultTimeout
 If $sElement = Default Then$sElement = ""
 If $iDelay Then Sleep($iDelay)
 Local $hLoadWaitTimer = TimerInit()  While True  If$sElement <> '' Then
 _WD_ElementAction($sSession,$sElement, 'name')
 If $_WD_HTTPRESULT =$HTTP_STATUS_NOT_FOUND Then $sElement = ''  Else $sResponse = _WD_ExecuteScript($sSession, 'return document.readyState', '') $iErr = @error
 If $iErr Then  ExitLoop  EndIf $oJSON = Json_Decode($sResponse) $sReadyState = Json_Get($oJSON, "[value]")  If$sReadyState = 'complete' Then ExitLoop
 EndIf
 If (TimerDiff($hLoadWaitTimer) >$iTimeout) Then
 $iErr =$_WD_ERROR_Timeout
 ExitLoop
 EndIf
 Sleep(100)
 WEnd
 If $iErr Then  Return SetError(__WD_Error($sFuncName, $iErr, ""), 0, 0)  EndIf  Return SetError($_WD_ERROR_Success, 0, 1)

EndFunc

Any sugestions or examples?

##### Share on other sites

Hi Picorico2 and welcome!

First, when we post code we use the button that looks like this: <>  on the forum post editor.

Second, what do you mean you don't know how to use it? Have you installed a driver for your browser? Does _WD_CreateSession work? Do you not understand the _WD_LoadWait parameters? (Being a little more specific goes a long way)

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

##### Share on other sites

Did you happen to look in wd_demo.au3? There's an example in there showing how to call _WD_LoadWait.

P.S. Instead of posting the UDF function, it would have been better if you had posted your code so that we can see what you are trying to do and where you may have gone awry.

##### Share on other sites

Its an honor that the creator of the Web Driver has answered me.

I just want to open a web page, and pause the script until it fully loads.

and do I have to use the line below (I'm a newbie)

$sSession = _WD_CreateSession($sDesiredCapabilities)

##### Share on other sites

After creating the session, you can then navigate to the desired site using _WD_Navigate. Next you would call _WD_LoadWait. Something like this --

_WD_Navigate($sSession, "http://google.com") _WD_LoadWait($sSession)

_WD_LoadWait offers several optional parameters. Look at the function header for a description of what action each one performs. Try writing some code to "practice" using these optional features. Then come back and let us know how you fared.

##### Share on other sites

Good Morning Danp2,

I got an error that says that I haven´t declared the variable so I copied the line below from your demo but still doesn´t do anything

Local $sDesiredCapabilities,$iIndex, $sSession Here's the code: #include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Local$sDesiredCapabilities, $iIndex,$sSession

_WD_Navigate($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/indexMs.php") _WD_LoadWait($sSession)

Like I said I´m a newbie but I want to learn, pls be patient. 😄

##### Share on other sites

I would really suggest taking a look at wd_demo.au3 that comes with the UDF. You're looking for something a bit more like this: (untested)

#include <MsgBoxConstants.au3>
#include <wd_core.au3>
#include <wd_helper.au3>

; Here you can specify some browser specific settings... you'll need to research them depending on your browser
; ... or just copy paste someone else's code :D

#Region Settings Setup
_WD_Option('Driver', 'geckodriver.exe')
_WD_Option('DriverParams', '--log trace')
_WD_Option('Port', 4444)

Global $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' #EndRegion Settings Setup ; You need to initialize some stuff with this UDF _WD_Startup() ; If there is an error setting stuff up, then exit If @error <>$_WD_ERROR_Success Then
Exit -1
EndIf

; Create a new instance of a browser with some settings you request
Global $sSession = _WD_CreateSession($sDesiredCapabilities)
; If there was an error, exit
If Not (@error = $_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.")

; Move to the requested website
_WD_Navigate($sSession, "http://yourwebsite.com") ; Anything you want to do after navigating to the website goes here MsgBox($MB_ICONINFORMATION, "Navigation completed!", "Click ok to shutdown the browser and console")

; This removes the browser instance
_WD_DeleteSession($sSession) ; And this cleans up some resources _WD_Shutdown() Edit 1: Updated with Gecko driver settings... didn't realize that was used for FireFox Edit 2: _WD_Options goes before _WD_Startup Edited by seadoggie01 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 ##### Link to post ##### Share on other sites Excellent my friend, and thank you. I´ll try my best. ##### Link to post ##### Share on other sites I get this error with your script _WD_Startup ==> Invalid value: Location for Web Driver not set. ##### Link to post ##### Share on other sites Did you download the geckodriver? If yes: Is it located in your script's directory, or did you properly specify the location of it? 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 ##### Link to post ##### Share on other sites Same error, here's the line _WD_Option('Driver', 'C:\Program Files (x86)\AutoIt3\Include\geckodriver.exe') ##### Link to post ##### Share on other sites @picorico2 Please post the complete results from the Scite output panel. ##### Link to post ##### Share on other sites My apologies, a little dyslexia going on there... _WD_Options goes first, then _WD_Startup... I'll edit my post 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 ##### Link to post ##### Share on other sites Works like a CHARM. Thank you very much Sir. We´ll keep in touch. ##### Link to post ##### Share on other sites Hi there again, Now for some unknown reason it has stopped working It doesn´t open the web page anymore and continues the script. Here's my code: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <MsgBoxConstants.au3> #include <wd_core.au3> #include <wd_helper.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> HotKeySet("{Esc}", "ExitScript")$_WD_DEBUG = $_WD_DEBUG_None ; You could also use$_WD_DEBUG_Error

; Here you can specify some browser specific settings... you'll need to research them depending on your browser
; ... or just copy paste someone else's code

#Region Settings Setup
_WD_Option('Driver', 'C:\Program Files (x86)\AutoIt3\Include\geckodriver.exe')
_WD_Option('DriverParams', '--log trace')
_WD_Option('Port', 4444)

Global $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' #EndRegion Settings Setup ; You need to initialize some stuff with this UDF _WD_Startup() ; If there is an error setting stuff up, then exit If @error <>$_WD_ERROR_Success Then
Exit -1
EndIf

; Create a new instance of a browser with some settings you request
;Global $sSession = _WD_CreateSession($sDesiredCapabilities)
; If there was an error, exit
;If Not (@error = $_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.")

Local $sDestination = "E:\Documentos\AUTOIT\palomitav.jpg" Local$sDesiredCapabilities, $iIndex,$sSession

;Verificar si la serie es correcta

MsgBox($MB_SYSTEMMODAL, "Serie", "Favor de copiar la serie y dar clic en Aceptar") SplashTextOn("", "Verificando la serie en Pago Referenciado...", 200, 60, 1400, 5, 600, 60, opt = 1) ; Ancho_Ven, Alto_Ven Y, Send("^{TAB}") _WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/indexMs.php")

Send("{TAB 3}")
Sleep(1000)
Send("{ENTER}")

_WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/menuOper.php") MouseMove(1047, 115, 5) MouseMove(1047, 145, 5) MouseMove(1223, 145, 5) MouseMove(1223, 170, 5) MouseClick("left") _WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/PagoTenencia/tenencia2015/admin.php")

Send("{TAB}")
Send("^v")
MouseMove(404, 224, 5)
MouseClick("left")

SplashOff()

$a = MsgBox(4, "", "¿Es correcta la serie?") If$a = 6 Then ;SI

;MouseMove(309, 476, 5)
;MouseClick("left")
Send("{TAB 6}")
;Sleep(500)
Send("{DOWN 3}")
Send("{TAB}")
Send("{ENTER}")

Send("{TAB}")
Send("{ENTER}")

_WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/PagoTenencia/tenencia2015/index.php?i=3&usu=570&serie=8AFDR5ADXA6284122&sid=0.29255510000995255") Send("{END}") ElseIf$a = 7 Then ;NO

Send("^+{TAB}")

MsgBox($MB_SYSTEMMODAL, "Placa", "Favor de copiar la PLACA y dar clic en Aceptar") Send("^{TAB}") MouseMove(425, 226, 5) MouseClick("left") Sleep(1000) Send("{TAB}") Send("^v") Sleep(10000)$a = MsgBox(4, "", "¿Es correcta la placa?")

If $a = 6 Then ;SI MouseMove(95, 295, 5) MouseClick("left") MouseMove(404, 224, 5) MouseClick("left") MouseMove(309, 517, 5) MouseClick("left") Sleep(1000) Send("{DOWN 3}") Send("{ENTER}") Sleep(1000) Send("{TAB}") Send("{ENTER}") Sleep(1000) Send("{TAB 2}") Send("{ENTER}") Sleep(4000) Send("{END}") ElseIf$a = 7 Then ;NO

;WinActivate ("Cobro de Tenencia ::: Sistema Pago Referenciado - Mozilla Firefox")

Sleep(1000)

Send("^+{TAB}")

Send("r")

Sleep(3000)

Send("El número de serie y placa son incorrectos")

EndIf

EndIf

Func ExitScript()
Exit
EndFunc   ;==>ExitScript

##### Share on other sites

and this:

so I propose you to edit your post because the code you posted is not posted well (is not formated).

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * *
ADO.au3 UDF * * * for 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 to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

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

"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"
, 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: 2021-10-18

##### Share on other sites
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.14.5
Author:         myName

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <MsgBoxConstants.au3>
#include <wd_core.au3>
#include <wd_helper.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{Esc}", "ExitScript")

$_WD_DEBUG =$_WD_DEBUG_None ; You could also use $_WD_DEBUG_Error ; Here you can specify some browser specific settings... you'll need to research them depending on your browser ; ... or just copy paste someone else's code :D #Region Settings Setup _WD_Option('Driver', 'C:\Program Files (x86)\AutoIt3\Include\geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) Global$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
#EndRegion Settings Setup

; You need to initialize some stuff with this UDF
_WD_Startup()
; If there is an error setting stuff up, then exit
If @error <> $_WD_ERROR_Success Then Exit -1 EndIf ; Create a new instance of a browser with some settings you request ;Global$sSession = _WD_CreateSession($sDesiredCapabilities) ; If there was an error, exit ;If Not (@error =$_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.") Local$sDestination = "E:\Documentos\AUTOIT\palomitav.jpg"

Local $sDesiredCapabilities,$iIndex, $sSession ;Verificar si la serie es correcta MsgBox($MB_SYSTEMMODAL, "Serie", "Favor de copiar la serie y dar clic en Aceptar")

SplashTextOn("", "Verificando la serie en Pago Referenciado...", 200, 60, 1400, 5, 600, 60, opt = 1)
; Ancho_Ven, Alto_Ven        Y,

Send("^{TAB}")

_WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/indexMs.php") Send("{TAB 3}") Sleep(1000) Send("{ENTER}") _WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/menuOper.php")

MouseMove(1047, 115, 5)
MouseMove(1047, 145, 5)
MouseMove(1223, 145, 5)
MouseMove(1223, 170, 5)
MouseClick("left")

_WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/PagoTenencia/tenencia2015/admin.php") Send("{TAB}") Send("^v") MouseMove(404, 224, 5) MouseClick("left") SplashOff()$a = MsgBox(4, "", "¿Es correcta la serie?")

If $a = 6 Then ;SI ;MouseMove(309, 476, 5) ;MouseClick("left") Send("{TAB 6}") ;Sleep(500) Send("{DOWN 3}") Send("{TAB}") Send("{ENTER}") Send("{TAB}") Send("{ENTER}") _WD_LoadWait($sSession, "https://guerrero.gob.mx/Pry_PagoReferenciado/Administracion/PagoTenencia/tenencia2015/index.php?i=3&usu=570&serie=8AFDR5ADXA6284122&sid=0.29255510000995255")

Send("{END}")

ElseIf $a = 7 Then ;NO Send("^+{TAB}") MsgBox($MB_SYSTEMMODAL, "Placa", "Favor de copiar la PLACA y dar clic en Aceptar")

Send("^{TAB}")

MouseMove(425, 226, 5)
MouseClick("left")

Sleep(1000)
Send("{TAB}")
Send("^v")
Sleep(10000)

$a = MsgBox(4, "", "¿Es correcta la placa?") If$a = 6 Then ;SI

MouseMove(95, 295, 5)
MouseClick("left")
MouseMove(404, 224, 5)
MouseClick("left")
MouseMove(309, 517, 5)
MouseClick("left")
Sleep(1000)
Send("{DOWN 3}")
Send("{ENTER}")
Sleep(1000)
Send("{TAB}")
Send("{ENTER}")
Sleep(1000)
Send("{TAB 2}")
Send("{ENTER}")
Sleep(4000)
Send("{END}")

Finally, be careful with your variable declarations. I see where you are declaring some variables as Global and then redeclaring them as Local ($sDesiredCapabilities for example). ##### Link to post ##### Share on other sites Ok. I removed the debugging mode. I commented out the line containing the _WD_CreateSession because I don´t want to open a new Firefox Windows, I just want to move to the next tab on the right, open a web site, wait for it to finish loading and move on, and finally I don´t undertand about variables and declarations pls help me to fix the code, and also can you tell me what´s the meaning of "DesiredCapabilities" sound funny to me. English is not my first language. The main reason I want to use Webdrive is because sometimes the web site I´m trying to access in Firefox takes longer to completely load than usual so if I use "Sleep" is not very accurate. Thank you kindly. ##### Link to post ##### 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 • ### Recently Browsing 0 members No registered users viewing this page. • ### Similar Content • This is for those pages that seem to load when you use _FFOpenURL(), but they have a text saying "please wait while we load your page..." but according to _FFOpenURL() the page has loaded. An example seen in popular sites is the Cloudflare page saying "Checking your browser before...". It's the opposite of pausing a script until an element is visible on a page. It takes Elements in the form of id, xpath or text search. Global$BrowserPort = 4242 Global $TimeOut = 60000 Global$LocalHost = "127.0.0.1" Func _FFWaitWhileElement($thiselement,$elementtype = "xpath", $timeoutms = 60000) _FFConnect($LocalHost, $BrowserPort,$TimeOut) Local $Element Local$ElementFound = 1 Local $TimeoutCountdown = 0 While$ElementFound <> 0 And $TimeoutCountdown <$timeoutms If $elementtype = "xpath" Then$Element = _FFXPath($thiselement) EndIf If$elementtype = "id" Then Local $ConstructXPath = ".//*[@id='" &$thiselement & "']" $Element = _FFXPath($ConstructXPath) EndIf ; MsgBox(0, "", $Element) Local$ElementXPathTextContent = _FFCmd("FFau3.xpath.textContent") ; MsgBox(0, "", $ElementXPathTextContent) Local$ElementXPathInnerHTML = _FFCmd("FFau3.xpath.innerHTML") ; MsgBox(0, "", $ElementXPathInnerHTML) If$ElementXPathTextContent = "_FFCmd_Err" Or $ElementXPathInnerHTML = "_FFCmd_Err" Then$ElementFound = 0 Else $ElementFound = 1 EndIf If$elementtype = "text" Then $ElementFound = _FFSearch($thiselement) ; MsgBox(0, "", $ElementFound) EndIf$TimeoutCountdown += 1000 _FFDisConnect() _FFConnect($LocalHost,$BrowserPort, $TimeOut) WEnd Return$ElementFound EndFunc _FFConnect($LocalHost,$BrowserPort, $TimeOut) _FFOpenURL("https://www.site.com/page", True) _FFWaitForElement("Please Wait...","text", 60000) MsgBox(0,"","Page finished loading") It's pretty simple, hope it helps some of you who are working with FF.au3 :) • So I was trying to write a function that can find a button (or any other XPath Element) and scroll the page + move the mouse to the location of the button. My logic for this was: 1. get position of button using _FFGetPosition 2. get inner dimensions of browser window and total dimensions of page 3. divide total dimensions by inner dimensions to get number of page down operations 4. use Mod() to get remaining pixels offset 5. MouseMove() and add requisite offsets for Titlebar etc (what the +5 and +54 is for in the last line) Example Code: _FFConnect($LocalHost, $BrowserPort,$TimeOut) Local $Button = _FFXPath(".//*[@id='thisbutton']") Local$ButtonPosition = _FFGetPosition($Button) Local$ElementWidth = $ButtonPosition[0] Local$ElementHeight = $ButtonPosition[1] Local$InnerWidth = _FFCmd("window.content.innerWidth") Local $InnerHeight = _FFCmd("window.content.innerHeight") Local$PageWidth = _FFCmd(".body.offsetWidth") Local $PageHeight = _FFCmd(".body.offsetHeight") Local$PGDNNo = Int($ElementHeight/$InnerHeight) Local $PGDNMod = Mod($ElementHeight, $InnerHeight) ; MsgBox(0,"","$ElementX: " & $ElementWidth & @CRLF & "$ElementY: " & $ElementHeight) ; MsgBox(0,"","$InnerWidth: " & $InnerWidth & @CRLF & "$InnerHeight: " & $InnerHeight) ; MsgBox(0,"","$PageWidth: " & $PageWidth & @CRLF & "$PageHeight: " & $PageHeight) ; MsgBox(0,"",$PGDNNo) ; MsgBox(0,"",$PGDNMod) Local$iter = 1 While $iter <=$PGDNNo WinActivate($BrowserWindowClass,"") _FFCmd("window.content.scrollByPages(1)")$iter += 1 WEnd MouseMove($ElementWidth + 5,$PGDNMod + 54) This isn't working. In some cases, it's not doing the page down operation the number of times needed, or not accurately pinpointing the location. I think there may be something wrong with the logic I'm using. What am I doing wrong?
Thanks.

• By mLipok
Recently I start wd_capabilities.au3 project on my side.
I think this is time to share to AutoIt community.
Check attached UDF: wd_capabilities.au3

Here is a scratch example showing how to use them:
#include "wd_helper.au3" #include "wd_capabilities.au3" _Example() Func _Example() ........ ........ ........ _WD_Capabilities_Build_Arguments(Null) ; CLEANUP ARGS _WD_Capabilities_Build_Arguments('--headless') _WD_Capabilities_Build_Arguments('start-maximized') _WD_Capabilities_Build_Arguments('disable-infobars') _WD_Capabilities_Build_Arguments('user-data-dir', 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default') Local $s_WD_Capabilities_Arguments = _WD_Capabilities_Build_Arguments(Default) ; GET ARGS _WD_Capabilities_Build_Preferences(Null) ; CLEANUP PREFS If$s_Download_dir Then _WD_Capabilities_Build_Preferences('download.default_directory', $s_Download_dir) Local$s_WD_Capabilities_Preferences = _WD_Capabilities_Build_Preferences(Default) ; GET PREFS Local $s_Desired_Capabilities = _WD_Capabilities_Build_JSON('chrome',$s_WD_Capabilities_Arguments, $s_WD_Capabilities_Preferences) Local$WD_SESSION = _WD_CreateSession($s_Desired_Capabilities) ........ ........ ........ EndFunc I plan to publish the code on GitHub. In the indefinite future, when the project becomes more functional, if @Danp2 accepts it, I hope it may be included in the main WebDriver UDF. I am waiting for yours feedback and help in the further development of this project. REMARK 1: As so far this UDF only supports GoogleChrome. Adding support for other browsers shouldn't be difficult, I just didn't need to. REMARK 2: For now, this project is working but still as a early BETA, so please do not discuss, ask questions, or post examples or snippets of code that pertain to any function of this UDF in other part of this forum, until it is found acceptable. Simply: discusion and tests only here in this topic. Regards, @mLipok • By Sanja Hello forum, I have the problem that I can not use Firefox in combination with WebDriver when using AutoIt on some websites. Of course it does not work with the very website I need it to work with. As soon as I want to open the desired website, I get the little robot icon which tells me that the "browser is under remote control" and the website stays blank. I CAN open the website (www.ebay-kleinanzeigen.de) but I get blocked when I want to go to my account, to be precise. I am using AutoIt 3.3.14.5 I have checked my FireFox version. It is up to date. Also the special browser drivers like gecko etrc. are up to date too and everything works fine with the WebDriver demo. It seems that another user also had the same problem, but the thread has already been closed and the users solution (setting security lower did not work for me). I mean I can only choose between "standard", "strict" and "customized". On "customized I unchecked everything but it still would not change anything. I also have checked Google Chrome and MS Edge. Same result. I tried swiching profiles (only with FireFox). Same result. I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet: _WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing --marionette-port 2828') _WD_Option('Port', 4444) Obviously I adjusted the path of the geckodriver.exe but it did not work at all on my computer. So far my code is really basically nothing but I can not even start to code. I myself am not a real coder and I know only the very basics like loops, conditions and variables. ---------------------------------------- ; Script Start #include <Array.au3> #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <StaticConstants.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <WindowsConstants.au3> Local$sDesiredCapabilities, $sSession,$sElement SetupGecko() $_WD_DEBUG =$_WD_DEBUG_None _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.ebay-kleinanzeigen.de/m-meine-anzeigen.html?sort=CREATION_DATE_ASC&keyword=winter") Exit Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444)$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & "C:/Users/myaccount/AppData/Roaming/Mozilla/Firefox/Profiles/0123456.default-release" & '"],"log": {"level": "trace"}}}}}' EndFunc ;==>SetupGecko Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}' EndFunc ;==>SetupChrome Func SetupEdge() _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}' EndFunc ;==>SetupEdge --------------------------------------
I left the three setup functions in, because I do not care what browser I use as long as I can start coding.
Also, please understand that I am not trying to be lazy here. I do not want someone to code for me. Maybe the problem is very basic, but I just do not know how to eliminate that restriction.
Is it something I need to uncheck in the browser settings or is it more complicated? If you need more information, I will be happy to provide those.
If somebody has an idea or a solution, I would very much appreciate it.

Edit:
I am not bothered by the robot icon itself. I do not care about it.  If I try to acess my regular ebay account: "https://mesg.ebay.de/mesgweb/ViewMessages/0" it works like a charm despite the notification that the browser is remotely controlled.
My problem is, that the first website does not load for some reason ONLY when the browser is remote controlled.
• By FUD
hello
i need to open link in default browser only one windows without duplicate if i try to open the same link

thanks
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...