sarge Posted April 27, 2020 Share Posted April 27, 2020 Danp2, thanks again for your help The working version of the line looks like this: $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' &$b&'"],"log": {"level": "trace"}}}}}' I’ll no longer risk asking about random browser behavior, although I really want to know :-) Thank you! Link to comment Share on other sites More sharing options...
sarge Posted April 28, 2020 Share Posted April 28, 2020 (edited) Hello again, I got a problem connecting to open sessions: expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Schedule For $i = 1 to 2 Step 1 $p = 2827 + $i $b = 'C:/4studio/FFProfiles/Bot'&$i SGLoop() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://2ip.ru") Next Case $Now For $i = 1 to 2 Step 1 $p = 2827 + $i $b = 'C:/4studio/FFProfiles/Bot'&$i urlins() Next EndSwitch WEnd Func urlins() SGLoop() _WD_Startup() _WD_Option('DriverParams', '--connect-existing') $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://test.com/login/") EndFunc Func SGLoop() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) _WD_Option('DriverParams', '--marionette-port ' & $p) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' &$b&'"],"log": {"level": "trace"}}}}}' EndFunc The first button Case $Schedule, I open the browser window and a link to https: //2ip.ru Everything opens normally. The second button Case $Now, I try in open sessions to change the link to test.com And here there is a problem, firefox constantly issues a request to close the browser window. He wants to complete the running process to open a new window! Although the link in the open windows changes .... What am I doing wrong? P.S. I apologize for the importunity. Edited April 28, 2020 by sarge Link to comment Share on other sites More sharing options...
Danp2 Posted April 28, 2020 Author Share Posted April 28, 2020 A couple of issues I can see -- You should make all calls to _WD_Option before calling _WD_Startup You need to combine your attempts to set DriverParams to a single call to _WD_Option, like this -- _WD_Option('DriverParams', '--log trace --connect-existing --marionette-port ' & $p) Also, can you explain why you chose this implementation? Did you considered saving the Session IDs to an array and then reusing them from there? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sarge Posted April 28, 2020 Share Posted April 28, 2020 Fixed it: Func urlins() SGLoop() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://test.com/login/") EndFunc Func SGLoop() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('Port', 4444) _WD_Option('DriverParams', '--log trace --marionette-port ' & $p) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' &$b&'"],"log": {"level": "trace"}}}}}' EndFunc When a button Case $Now is pressed, the urlins() function is called. In this function, function SGLoop is first executed, in which all parameters _WD_Option are registered before _WD_Startup. But without result 😞 Regarding the introduction of the array, this is a great idea, but unfortunately I'm not too experienced in autoit, if you give a link to an example, I will do just that. Link to comment Share on other sites More sharing options...
Danp2 Posted April 28, 2020 Author Share Posted April 28, 2020 @sarge This thread is intended for discussing bugs or enhancements to the Webdriver UDF. I would recommend that you start a new thread to discuss your specific needs / issues. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
sarge Posted April 28, 2020 Share Posted April 28, 2020 @Danp2 OK. Repeat my question to: https://www.autoitscript.com/forum/topic/202554-webdriver-firefox-opening-existing-sessions/ Link to comment Share on other sites More sharing options...
Danp2 Posted May 1, 2020 Author Share Posted May 1, 2020 v0.2.0.8 just released with the following changes -- - Fixed: Error handling in _WD_IsLatestRelease - Changed: Add support for DriverClose option to _WD_Option - Changed: _WD_Startup no longer closes existing driver consoles if DriverClose option (_WD_Option) is False - Changed: Add support for HTTPTimeouts option to _WD_Option - Changed: Set timeouts for WinHTTP requests if HTTPTimeouts option (_WD_Option) is True Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
hoangvu0905 Posted May 8, 2020 Share Posted May 8, 2020 Hello Danp2, i have a question. Has you has ever sent the {enter} key in the element? Please show me. (I know it is related to _WD_ElementAction) cadicvn0006 1 Link to comment Share on other sites More sharing options...
Danp2 Posted May 8, 2020 Author Share Posted May 8, 2020 Maybe this will help -- cadicvn0006 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted May 12, 2020 Author Share Posted May 12, 2020 (edited) v0.2.0.9 just released with the following changes -- - Changed: _WD_Status now returns Dictionary object instead of raw JSON string - Changed: Add support for DebugTrim option to _WD_Option - Changed: Remove check for $HTTP_STATUS_SERVER_ERROR (chromedriver relic) - Changed: Improved output from _WD_IsLatestRelease - Fixed: Default arguments for _WD_ExecuteScript should be empty string - Fixed: Removed unneeded string conversion - Added: Generic error detection routine All primary functions will now detect additional errors, such as Invalid Session ($WD_InvalidSession) P.S. Let me know if you encounter any issues with the generic error checking routine I added. Edited May 12, 2020 by Danp2 cadicvn0006 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted May 25, 2020 Author Share Posted May 25, 2020 v0.3.0.1 just released with the following changes -- - Changed (_WD_Window): Add support for New option - Changed (_WD_Window): Add support for Print option - Changed (_WD_Window): Window option can now be used to switch tabs (ala existing 'switch' option) - Added: Unknown Command error detection Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
auitden Posted June 1, 2020 Share Posted June 1, 2020 _WD_WaitElement($sSession, $_WD_LOCATOR_ByXpath, "//input[@name='example']") If @error = $_WD_ERROR_Timeout Then MsgBox(0, "", "Timeout") Else MsgBox(0, "", "Example form loaded") EndIf How correctly check that form loaded after 5 sec and if no then try again (5 sec). like a two tryies before send timeout button? I'm confused with $iDelay = Default, $iTimeout = Default... Link to comment Share on other sites More sharing options...
Danp2 Posted June 1, 2020 Author Share Posted June 1, 2020 @auitden Check out the first few lines of code for the function and that should reveal how the parameter defaults are handled when they are omitted or equal to the Default keyword. Why do you need to make two attempts for 5 secs each instead of a single attempt for 10 secs? auitden 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
auitden Posted June 1, 2020 Share Posted June 1, 2020 20 minutes ago, Danp2 said: @auitden Check out the first few lines of code for the function and that should reveal how the parameter defaults are handled when they are omitted or equal to the Default keyword. Why do you need to make two attempts for 5 secs each instead of a single attempt for 10 secs? Because I don't understand what i doing. I want something like a max waiting time, for example: set param to 10 sec, if form loaded after 2 sec - ok, if 5 sec, but if after 10 sec form not loaded - timeout error, For ideally I want this) But not understand how i can setup it. _WD_WaitElement($sSession, $_WD_LOCATOR_ByXpath, "//input[@name='example']", 2500, 10000) 4 attempts with 2,5 sec checking (10 sec max waiting time before exit), correctly? Link to comment Share on other sites More sharing options...
Danp2 Posted June 1, 2020 Author Share Posted June 1, 2020 The current default wait is 10 secs, so all you need to do is provide the first few parameters -- _WD_WaitElement($sSession, $_WD_LOCATOR_ByXpath, "//input[@name='example']") This will internally loop and continually check for the designated element. If it isn't found within those 10 secs, then it will return with @error set to _WD_ERROR_Timeout. If you use the $iDelay parameter, this delay only occurs once, before the initial search occurs. auitden 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
yeison1412 Posted June 10, 2020 Share Posted June 10, 2020 Greetings to all, I have a problem executing a bot compiled from autoit, which was done on another pc where it worked well, I moved the bot to another pc and I get a series of errors related to WD_CORE, how should I proceed? Link to comment Share on other sites More sharing options...
Danp2 Posted June 10, 2020 Author Share Posted June 10, 2020 @yeison1412 You can suppress the messages from popping up by placing the following near the top of your script -- $_WD_ERROR_MSGBOX = False Note: This doesn't eliminate the error. It just prevents the messages from being shown. My wild guess would be that the webdriver executable is missing on the new pc, but no way to know for sure what the issue is with the limited details you've provided this far. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Hieuvt88 Posted June 10, 2020 Share Posted June 10, 2020 Sorry for the suddenly, I have problem with search box, i need touch that and fill some data, Do you have any idea? Thanks, Link to comment Share on other sites More sharing options...
Danp2 Posted June 11, 2020 Author Share Posted June 11, 2020 @Hieuvt88 What have you tried? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
yeison1412 Posted June 11, 2020 Share Posted June 11, 2020 Hace 2 horas, yeison1412 dijo: Saludos a todos, tengo un problema al ejecutar un bot compilado de autoit, que se realizó en otra PC donde funcionó bien, moví el bot a otra PC y recibo una serie de errores relacionados con WD_CORE, ¿cómo debo proceder? Este es un código que encontré en Internet para iniciar el control de Chrome, pero me envía un conjunto de errores. Falta algo en el incluye? y también tengo el controlador de Chrome de acuerdo con la versión de mi Chrome Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now