Danp2 Posted September 25, 2020 Author Share Posted September 25, 2020 @Jemboy Perhaps you can explain why you have to keep making these changes. FWIW, most of the examples that you will find online are geared towards Selenium so not sure will meet your needs. Sounds like we need another "helper" function that assists in this task. FrancoDM 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jemboy Posted September 27, 2020 Share Posted September 27, 2020 (edited) @Danp2 YES, I vote for an extra helper function!😀 To eleborate why I suddenly need to change the "capabilties"... We used to start IE or Edge and do a Google on Chrome, download the setup-file and install the Chrome browser. I developped a script that used Chromdriver within our company and everything worked. Suddenly, after installing a new computer, the script didn't seem to work on this specific computer. As a last resort I installed AutoIt on the computer to debug the problem and found out that Chromedriver couldn't find the Chrome.exe. It seemed that on this computer Chrome had been installed as a x64 program within the "C:\Program Files\Google\Chrome\Application\" folder. I remotely checked over 50 PCs (all Win10 x64) and Chrome was always installed within the "C:\Program Files (x86)\Google\Chrome\Application\" folder, so it seems like something changed. Googling I found that one can point the Chromedriver to the location of the Chrome browser by adding the location to the "capabilties", however, I could not get that working with my already "custom" one. Hence, I justed installed the x86 Chrome on the computer and left this future change for the future... when "capabilities" would be better understood by me😁 Edited September 27, 2020 by Jemboy Link to comment Share on other sites More sharing options...
pytruong Posted September 29, 2020 Share Posted September 29, 2020 (edited) Hello, Trying to find the element for this chunk of code, there are 4 buttons with similar structures (div -> button -> div -> div sytle), but sometimes 2 of the 4 buttons are not available. When I put it into an array with _WD_FindElement, I see that it sees (finds?) the buttons and it's always the 3rd one (only if it's available, since sometimes 2/4 buttons are not there). So I figured I might have to look for some sort of "contains text" but I can't seem to figure it out correctly. Chunk of code: <div style="color: rgb(54, 67, 80); background-color: rgb(255, 255, 255); transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; box-sizing: border-box; font-family: Poppins; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px; border-radius: 2px; display: inline-block; min-width: 100%;"> <button tabindex="0" type="button" style="border: 10px; box-sizing: border-box; display: inline-block; font-family: Poppins; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); cursor: pointer; text-decoration: none; margin: 0px; padding: 0px; outline: none; font-size: inherit; font-weight: inherit; position: relative; height: 36px; line-height: 36px; width: 100%; border-radius: 2px; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; background-color: rgb(159, 195, 55); text-align: center;"> <div> <div style="height: 36px; border-radius: 2px; transition: all 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; top: 0px;"> <!-- react-text: 98 --> Button3 <!-- /react-text --> </div> </div> </button> </div> What I have to see all available buttons: $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div/button", Default, True) _ArrayDisplay($aElements, "Found Elements") What I thought would work but I get an error. _WD_FindElement ==> Webdriver Exception: HTTP status = 400 $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div/button/div[contains[text(),'Button3']") ConsoleWrite("$sElement = " & $sElement & @CRLF) Thank you in advance!! EDIT (after some Googling, I got it to return an element value). I think the above code I had only returns true/false (?). Going to have to try the below with some actions. $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[text()[contains(.,'Button3')]]") ConsoleWrite("$sElement = " & $sElement & @CRLF) Edited September 29, 2020 by pytruong I may have solved it myself? Link to comment Share on other sites More sharing options...
Danp2 Posted September 30, 2020 Author Share Posted September 30, 2020 @pytruong Lots of ways to skin a cat. Here's another option -- _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@type="button" and contains(text(), "Button3")]') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
pytruong Posted September 30, 2020 Share Posted September 30, 2020 14 hours ago, Danp2 said: @pytruong Lots of ways to skin a cat. Here's another option -- _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@type="button" and contains(text(), "Button3")]') @Danp2 Thank you! This gave me a 404 error. But once I changed contains(text(), "Button3") to contains(., "Button3") It found it. Also tried this, and it worked: '//*[@type="button" and div="Button3"]' Link to comment Share on other sites More sharing options...
duzers Posted October 1, 2020 Share Posted October 1, 2020 (edited) Hello, I have a problem with trading applet and NewTab. My code: expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include "misc.au3" Local $sDesiredCapabilities ; Set debug level $_WD_DEBUG = True ; Execute browser setup routine for user's browser selection _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose') ;_WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log') $param1='"capabilities": {' $param2='"alwaysMatch": {' $param3='"ms:edgeOptions": {' $param4='"w3c": true,' $param5='"args":["--start-maximized","--disable-infobars"],' $param6='"excludeSwitches": [ "enable-automation"],' $param7='"useAutomationExtension": false' $sDesiredCapabilities = '{' & $param1 & $param2 & $param3 & $param4 & $param5 & $param6 & $param7 & '}}}}' _WD_Startup() If @error <> $_WD_ERROR_Success Then msgbox(0,"Error", "Failed to create session." & @CRLF & "Select [Ok] to Exit") Exit -1 EndIf $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.supermakler.pkobp.pl/plus/demo/") _WD_WaitElement($sSession,$_WD_LOCATOR_ByXPath,"//button[contains(text(),'lij')]") sleep(1000) _WD_NewTab($sSession) _WD_Navigate($sSession, "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe zlecenie") MsgBox($MB_ICONINFORMATION, "Demo complete!", "Click ok to shutdown the browser and console") _WD_DeleteSession($sSession) _WD_Shutdown() But, when I open new tab with second link some elements detach from first tab (look at an attachement). When I use IE.au3 all elements from first tab stay in place. Edited October 1, 2020 by duzers Link to comment Share on other sites More sharing options...
comtech80 Posted October 1, 2020 Share Posted October 1, 2020 (edited) Hi Guys! Not sure if this has been asked before, I tried to do a search with limited results. Does anyone know how to put Chrome in Kiosk mode with the below code? my scripts works the way I want it to work besides a the new window feature but that's another topic.. My Code: expandcollapse popup#include <FUNC\wd_core.au3> #include <FUNC\wd_helper.au3> #include <FUNC\WinHttp.au3> #include <FUNC\WinHttpConstants.au3> Local $sDesiredCapabilities,$sSession,$Sv_Data,$File_Error,$time_delay _WD_Option('Driver', 'Chromedriver.exe ') _WD_Option("Port", 9515) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}}' _WD_Startup() Sleep(7000) $sSession=_WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession,'https://www.MYWEBSITE.com') _WD_LoadWait($sSession) $sElement1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='txtUserID']") _WD_ElementAction($sSession, $sElement1, 'clear') _WD_ElementAction($sSession, $sElement1, 'value', 'MYLOGIN') $sElement2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='txtPassword']") _WD_ElementAction($sSession, $sElement2, 'clear') _WD_ElementAction($sSession, $sElement2, 'value', 'MYPASSWD') $sElement3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='txtCompanyCode']") _WD_ElementAction($sSession, $sElement3, 'clear') _WD_ElementAction($sSession, $sElement3, 'value', 'MYCOMAPNYCODE') $sElement4 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@id='btnLogin_Label']") _WD_ElementAction($sSession, $sElement4, 'click') _WD_LoadWait($sSession) WinSetState("[CLASS:Chrome_WidgetWin_1]", "",@SW_MAXIMIZE) sleep(9000) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{TAB 1}") sleep(200) ControlSend("", "", "", "{ENTER}") My Output: expandcollapse popup_WD_IsLatestRelease: True _WD_IsLatestRelease ==> Success _WDStartup: OS: WIN_10 WIN32_NT 19041 _WDStartup: AutoIt: 3.3.14.5 _WDStartup: WD.au3: 0.3.0.9 (Up to date) _WDStartup: WinHTTP: 1.6.4.2 _WDStartup: Driver: Chromedriver.exe _WDStartup: Params: _WDStartup: Port: 9515 __WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false }}}} __WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.... _WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"85.0.4183.121","chrome":{"chromedriverVersion":"85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183@{#1689})","userDataDir":"C:\\Users\\XXXXXX\\AppData\\Local\\Temp\\scoped_dir7140_1234354639"},"goog:chromeOptions":{"debuggerAddress":"localhost:51615"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":true},"sessionId":"1e2aa3945dd465407c60bc97c5bae494"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/url; $sData={"url":"https://www.MYWEBSITE.com"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_Navigate: {"value":null} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element; $sData={"using":"xpath","value":"//input[@id='txtUserID']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"72260b1a-dfa1-4558-83f3-7ab0c477f5e5"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"72260b1a-dfa1-4558-83f3-7ab0c477f5e5"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/72260b1a-dfa1-4558-83f3-7ab0c477f5e5/clear; $sData={"id":"72260b1a-dfa1-4558-83f3-7ab0c477f5e5"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/72260b1a-dfa1-4558-83f3-7ab0c477f5e5/value; $sData={"id":"72260b1a-dfa1-4558-83f3-7ab0c477f5e5", "text":"MYLOGIN"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element; $sData={"using":"xpath","value":"//input[@id='txtPassword']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"b07005f6-3f9f-4a65-be15-241db7ca79ea"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"b07005f6-3f9f-4a65-be15-241db7ca79ea"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/b07005f6-3f9f-4a65-be15-241db7ca79ea/clear; $sData={"id":"b07005f6-3f9f-4a65-be15-241db7ca79ea"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/b07005f6-3f9f-4a65-be15-241db7ca79ea/value; $sData={"id":"b07005f6-3f9f-4a65-be15-241db7ca79ea", "text":"MYPASSWD"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element; $sData={"using":"xpath","value":"//input[@id='txtCompanyCode']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"9bbe09da-3694-49d2-b8b0-b347458ffe01"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"9bbe09da-3694-49d2-b8b0-b347458ffe01"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/9bbe09da-3694-49d2-b8b0-b347458ffe01/clear; $sData={"id":"9bbe09da-3694-49d2-b8b0-b347458ffe01"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/9bbe09da-3694-49d2-b8b0-b347458ffe01/value; $sData={"id":"9bbe09da-3694-49d2-b8b0-b347458ffe01", "text":"COMPANYCODE"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element; $sData={"using":"xpath","value":"//span[@id='btnLogin_Label']"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"d3045d61-e7a4-40a4-9d6a-a1a8e7311db6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"d3045d61-e7a4-40a4-9d6a-a1a8e7311db6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/element/d3045d61-e7a4-40a4-9d6a-a1a8e7311db6/click; $sData={"id":"d3045d61-e7a4-40a4-9d6a-a1a8e7311db6"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/1e2aa3945dd465407c60bc97c5bae494/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=200; ResponseText={"value":"complete"}... _WD_ExecuteScript: {"value":"complete"}... >Exit code: 0 Time: 25.16 Edited October 1, 2020 by comtech80 Link to comment Share on other sites More sharing options...
Danp2 Posted October 1, 2020 Author Share Posted October 1, 2020 @duzers That appears to be a functionality of the website (I get the same behavior when performing the steps manually). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
duzers Posted October 1, 2020 Share Posted October 1, 2020 2 minutes ago, Danp2 said: @duzers That appears to be a functionality of the website (I get the same behavior when performing the steps manually). Try with Internet Explorer. Link to comment Share on other sites More sharing options...
Danp2 Posted October 1, 2020 Author Share Posted October 1, 2020 @comtech80 Did you try searching this thread for the keyword "kiosk"? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted October 1, 2020 Author Share Posted October 1, 2020 Just now, duzers said: Try with Internet Explorer I don't need to. I tried it with Edge, Chrome, and Firefox. They all exhibited this behavior. Chances are that IE would do the same if it wasn't so outdated. 😄 duzers 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
comtech80 Posted October 2, 2020 Share Posted October 2, 2020 @Danp2 I did but the only results are for Firefox and not Chrome... Does the switch work for chrome as well? Link to comment Share on other sites More sharing options...
jugador Posted October 2, 2020 Share Posted October 2, 2020 @Danp2 your post on WINHTTP_OPTION_SECURE_PROTOCOLS Global $hRequest = _WinHttpOpenRequest($hConnect, "GET") ;;;;this work _WinHttpSetOption(_WinHttpQueryOption(_WinHttpQueryOption($hRequest, $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_SECURE_PROTOCOLS, BitOR($WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1, $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2)) ;;;;this not work!! why? _WinHttpSetOption($hRequest, $WINHTTP_OPTION_SECURE_PROTOCOLS, BitOR($WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1, $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2)) Global Enum $WinHttpRequestOption_UserAgentString, _ $WinHttpRequestOption_URL, _ $WinHttpRequestOption_URLCodePage, _ $WinHttpRequestOption_EscapePercentInURL, _ $WinHttpRequestOption_SslErrorIgnoreFlags, _ $WinHttpRequestOption_SelectCertificate, _ $WinHttpRequestOption_EnableRedirects, _ $WinHttpRequestOption_UrlEscapeDisable, _ $WinHttpRequestOption_UrlEscapeDisableQuery, _ $WinHttpRequestOption_SecureProtocols, _ $WinHttpRequestOption_EnableTracing, _ $WinHttpRequestOption_RevertImpersonationOverSsl, _ $WinHttpRequestOption_EnableHttpsToHttpRedirects, _ $WinHttpRequestOption_EnablePassportAuthentication, _ $WinHttpRequestOption_MaxAutomaticRedirects, _ $WinHttpRequestOption_MaxResponseHeaderSize, _ $WinHttpRequestOption_MaxResponseDrainSize, _ $WinHttpRequestOption_EnableHttp1_1, _ $WinHttpRequestOption_EnableCertificateRevocationCheck Global Const $SecureProtocol_SSL2 = 0x0008 Global Const $SecureProtocol_SSL3 = 0x0020 Global Const $SecureProtocol_TLS1 = 0x0080 Global Const $SecureProtocol_TLS1_1 = 0x0200 Global Const $SecureProtocol_TLS1_2 = 0x0800 $WinHttpReq = ObjCreate("winhttp.winhttprequest.5.1") $oErr = ObjEvent("AutoIt.Error", "_ErrorHandler") ........ ........ ........ ........ ;;;;this not work ;;;;how to do this using "winhttp.winhttprequest.5.1" $WinHttpReq.Option($WinHttpRequestOption_SecureProtocols) = BitOR($SecureProtocol_TLS1_1,$SecureProtocol_TLS1_2) Link to comment Share on other sites More sharing options...
duzers Posted October 2, 2020 Share Posted October 2, 2020 I have tried to send SessionID from first script to another one. With success. If you see any errors, please correct it. Script1: expandcollapse popup#include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include "misc.au3" Local $sDesiredCapabilities $_WD_DEBUG = True _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose') $param1='"capabilities": {' $param2='"alwaysMatch": {' $param3='"ms:edgeOptions": {' $param4='"w3c": true,' $param5='"args":["--start-maximized","--disable-infobars"],' $param6='"excludeSwitches": [ "enable-automation"],' $param7='"useAutomationExtension": false' $sDesiredCapabilities = '{' & $param1 & $param2 & $param3 & $param4 & $param5 & $param6 & $param7 & '}}}}' _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) ;save sessionID to clipboard ClipPut ( $sSession ) _WD_Navigate($sSession, "http://www.google.com") MsgBox(0, 'Init', "Script1. Don't close this!") _WD_Window($sSession,'close') _WD_DeleteSession($sSession) _WD_Shutdown() Script2: #include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include "misc.au3" $_WD_DEBUG = True _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log trace --verbose') ;_WD_Startup() $sSession = ClipGet() _WD_Attach($sSession, "http://www.google.com", "URL") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='q']") _WD_ElementAction($sSession, $sElement, 'value', "AutoIt") Link to comment Share on other sites More sharing options...
duzers Posted October 2, 2020 Share Posted October 2, 2020 (edited) 5 hours ago, comtech80 said: I don't need to. I tried it with Edge, Chrome, and Firefox. They all exhibited this behavior. Chances are that IE would do the same if it wasn't so outdated. I have to back to my problem. When I make new tab manually and go to URL "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe zlecenie", frame from main window stay at the place. My question is, how to get the webdrive to make a new tab in the same way? First way: send CTRL+T (new tab) and navigate to my url, but how to send CTRL+T from WebDrive? I have also noticed that New Tab from Edge is other than New Tab from WebDrive. Edited October 2, 2020 by duzers Link to comment Share on other sites More sharing options...
Danp2 Posted October 2, 2020 Author Share Posted October 2, 2020 5 hours ago, comtech80 said: I did but the only results are for Firefox and not Chrome... Does the switch work for chrome as well? AFAIK. Try it and report back. 😀 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jugador Posted October 5, 2020 Share Posted October 5, 2020 (edited) @Danp2 I hope you will answer this 😅 _WinHttpSetOption(_WinHttpQueryOption(_WinHttpQueryOption($hRequest, $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_SECURE_PROTOCOLS, BitOR($WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1, $WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2)) What the use of this line _WinHttpQueryOption($hRequest, $WINHTTP_OPTION_PARENT_HANDLE), $WINHTTP_OPTION_PARENT_HANDLE) no harm in using it in windows7 Edited October 5, 2020 by jugador Link to comment Share on other sites More sharing options...
Danp2 Posted October 5, 2020 Author Share Posted October 5, 2020 @jugador I believe that code came from @trancexx. I believe it retrieves the memory location that the handle ultimately accesses. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Jemboy Posted October 8, 2020 Share Posted October 8, 2020 (edited) In the past I have used AutoIt to automate website logon using de IE.au3. Scripts made almost 10 years ago are still working without a problem. Automating a new website logon, I encountered problems with IE being sluggish and switched to Chromedrive. Recently I found out that the Chromedriver will only look for Chrome in: C:\Program Files (x86)\Google\Chrome\Application\ If you have Chrome installed in any other folder, chromedriver will fail loading! Today I discovered aother problem, when an user told me his script (executable) was not working anymore. After some digging I found out, Google updated Chrome to version 86.0.x, however because I was using Chromedriver 84.0.x the script broke. I am using this script on about 100 computers and laptops, and because we are a "small" company with no central domain, I have to manually copy the new chromedriver to each computer. (I am not looking forward to this.) However I discovered also that not all computers are on Chrome 86.0.x yet, but some still have Chrome version 85.x.0. If I update the Chromedriver to 86.0.x on those computers the script will also brake...🥴 So my goal for know is to make a "helper" script, which will run as administrator ad do the following things: Compare Chrome main version with the main version of Chromedriver. If the main version is not equal, go to: https://chromedriver.storage.googleapis.com/index.html Check al the links and go to the folder with the highest main version equal to the Chrome.exe installed on the computer Download chromedriver_win32.zip Extract the chromedriver.exe and copy it to location from which the helper script was executed. (In my case a folder in c:\program files) By copying the "helper" script to the folder with the Chromedriver script and adding the helper script to originalscript (executing with run or runas), I might insure my script updating Chromedriver automatically in the future (if for instance the Chromedriver site or zip do not chane 😁) Edited October 8, 2020 by Jemboy Link to comment Share on other sites More sharing options...
Jemboy Posted October 8, 2020 Share Posted October 8, 2020 (edited) My current $sDesiredCapabilities is this: $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwithes": [ "enable-automation"], "useAutomationExtension": false,"prefs": {"credentials_enable_service": false}}}}}' I want to add the location of the Chrome browser in case Chromedriver can not find Chrome. The snippet below ought to tell Chromedriver where to find chrome when installed in "C:\Program Files (x86)\Google\Chrome\Application\" : $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"}}}}' I tried several ways, but I cannot figure out how to merge both $sDesiredCapabilities tohether. Could anyone tell me how to integrate the location of the Chrome browser into my current $sDesiredCapabilities ? Edited October 8, 2020 by Jemboy Link to comment Share on other sites More sharing options...
Recommended Posts