Danp2 Posted June 21, 2019 Author Share Posted June 21, 2019 @MilenPThis topic has been previously discussed. Try reviewing this post -- MilenP 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MilenP Posted June 24, 2019 Share Posted June 24, 2019 On 6/21/2019 at 2:30 PM, Danp2 said: @MilenPThis topic has been previously discussed. Try reviewing this post -- Hi @Danp2, Is there an option, to use the Default profile of the Firefox (with the Gecko driver), but without starting the firefox with --marionette manually? Quote Start Firefox manually with the "--marionette" option Use these settings to connect to the existing browser instance _WD_Option('DriverParams', '--log trace --connect-existing --marionette-port 2828') Thank you, Milen Link to comment Share on other sites More sharing options...
Danp2 Posted June 24, 2019 Author Share Posted June 24, 2019 @MilenP You may want to search this forum for the answer. If not found, then the next best thing is to look at the available options here. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Laks Posted June 25, 2019 Share Posted June 25, 2019 On 6/19/2019 at 2:25 PM, Danp2 said: I believe this is normal (msg is informational only). Did you experience any other issues when using Chromedriver? The driver is not getting launched. That's the problem Link to comment Share on other sites More sharing options...
Danp2 Posted June 25, 2019 Author Share Posted June 25, 2019 @Laks Please post the results from the Scite output panel after making the following change to your script -- $_WD_DEBUG = $_WD_DEBUG_Info Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
linhoanh Posted June 26, 2019 Share Posted June 26, 2019 (edited) Hi @danp2 Done thank you! Edited June 27, 2019 by linhoanh Link to comment Share on other sites More sharing options...
Danp2 Posted June 26, 2019 Author Share Posted June 26, 2019 @linhoanh The element is being found, but it apparently isn't clickable. You'll need to figure out why. Perhaps you've identified the wrong element or maybe you must perform some other action, such as logging in as a valid user, before the element is enabled. P.S. Why do you need to automate subscribing to a Youtube channel? This seems odd. Please explain. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
NSearch Posted June 26, 2019 Share Posted June 26, 2019 (edited) I don't believe this issue has been raised (at least not to my knowledge) and I was wondering if someone could help or let me know that they are also experiencing the problem (so I don't go mad!) I am trying to populate an input box on a website, but it will not populate using the following: <Snip> Thanks a ton for your help. @NSearch you seem to have not bothered to read our forum rules before posting. Please read them now, especially the section on Captcha and you will see why your post has been removed. Edited June 27, 2019 by JLogan3o13 Link to comment Share on other sites More sharing options...
linhoanh Posted June 27, 2019 Share Posted June 27, 2019 (edited) Thank @danp2 thank you! Edited June 27, 2019 by linhoanh Link to comment Share on other sites More sharing options...
NSearch Posted June 27, 2019 Share Posted June 27, 2019 6 hours ago, NSearch said: I don't believe this issue has been raised (at least not to my knowledge) and I was wondering if someone could help or let me know that they are also experiencing the problem (so I don't go mad!) I am trying to populate an input box on a website, but it will not populate using the following: <Snip> Thanks a ton for your help. @NSearch you seem to have not bothered to read our forum rules before posting. Please read them now, especially the section on Captcha and you will see why your post has been removed. I am not attempting to circumvent or break any security protocols -- in fact, I will say, it is impossible to do so on the captcha they use. I am simply trying to enter the Captcha (manually) into a GUI and have the GUI insert it into the input box. Why am I doing this? So that I do not have to copy and paste the tracking and invoice numbers into the screen. The input boxes for those have no issue accepting the values I send. Link to comment Share on other sites More sharing options...
jiataifeng Posted July 10, 2019 Share Posted July 10, 2019 On 1/17/2018 at 5:14 PM, Danp2 said: Introduction This UDF will allow you to interact with any browser that supports the W3C WebDriver specifications. Supporting multiple browsers via the same code base is now possible with just a few configuration settings. Requirements JSON UDF https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn WinHTTP UDF https://www.autoitscript.com/forum/topic/84133-winhttp-functions/ WebDriver for desired browser Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Function List Core Functions _WD_CreateSession($sDesiredCapabilities='{}') _WD_DeleteSession($sSession) _WD_Status() _WD_Timeouts($sSession, $sTimeouts = '') _WD_Navigate($sSession, $sURL) _WD_Action($sSession, $sCommand) _WD_Window($sSession, $sCommand, $sOption = '') _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement = "", $lMultiple = False) _WD_ElementAction($sSession, $sElement, $sCommand, $sOption='') _WD_ExecuteScript($sSession, $sScript, $sArguments="[]") _WD_Alert($sSession, $sCommand, $sOption = '') _WD_GetSource($sSession) _WD_Cookies($sSession, $sCommand, $sOption = '') _WD_Option($sOption, $vValue = "") _WD_Startup() _WD_Shutdown() Helper Functions _WD_NewTab($sSession, $lSwitch = True, $iTimeout = -1, $sURL = "", $sFeatures = "") _WD_Attach($sSession, $sString, $sMode = 'title') _WD_LinkClickByText($sSession, $sText, $lPartial = True) _WD_WaitElement($sSession, $sElement, $sStrategy, $sSelector[, $iDelay = 0[, $iTimeout = -1]]) _WD_GetMouseElement($sSession) _WD_GetElementFromPoint($sSession, $iX, $iY) _WD_LastHTTPResult() _WD_GetFrameCount() _WD_IsWindowTop() _WD_FrameEnter($sIndexOrID) _WD_FrameLeave() _WD_HighlightElement($sSession, $sElement[, $iMethod = 1]) _WD_HighlightElements($sSession, $aElements[, $iMethod = 1]) _WD_jQuerify($sSession) WD_ElementOptionSelect($sSession, $sStrategy, $sSelector, $sStartElement = "") _WD_ConsoleVisible($lVisible = False) Source Code You will always be able to find the latest version in the GitHub Repo Help / Support Please post any questions, suggestions or errors in the GH&S thread. https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/ How to set back the cookies obtained from 'getall' ? thanks. expandcollapse popup#include "wd_core.au3" Local $url = "https://www.google.com" Local $sDesiredCapabilities Local $sCookie Local $firsttime = 0 run() func run SetupChrome() _WD_Startup() $Session = _WD_CreateSession($sDesiredCapabilities) Sleep(2000) _WD_Navigate($Session, $url) ; for the fist time to get all the cookies and stored it for latter use. if firsttime==0 then sleep(60000) ; login to get all the cookies $sCookie = _WD_Cookies($Session, 'getall') endif ; for the other time, add storaged cookies so as to keep the logged in status. _WD_Cookies($Session, 'add', $sCookie) _WD_Navigate($Session, $url) _WD_Shutdown() firsttime = firsttime +1 EndFunc Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true}}}}' EndFunc Link to comment Share on other sites More sharing options...
Danp2 Posted July 10, 2019 Author Share Posted July 10, 2019 @jiataifeng No need to quote the entire initial post when asking a question. 🙄 This isn't something that I tried myself. I suspect that you will need to parse the JSON string to obtain each individual cookie, and then call the function to add each one individually. P.S. This question would be better asked in this thread in the GH&S section. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Holycow Posted July 11, 2019 Share Posted July 11, 2019 @Danp2 If there are multiple tabs opened, and executing _WD_Window($sSession,'Close') on any existing tab would kill the session, meaning you can longer control any remaining tabs. Could you please take a look at this? Link to comment Share on other sites More sharing options...
Danp2 Posted July 11, 2019 Author Share Posted July 11, 2019 @Holycow That's not the way it should work according to the W3C specs. How about posting a short script that demonstrates the issue. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Holycow Posted July 11, 2019 Share Posted July 11, 2019 expandcollapse popup#include <Constants.au3> #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.nbcnews.com/") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='content']/div/div[5]/div/div/div[2]/div/section/div[2]/div/div[1]/article/div[2]/h2/a/span") _WD_ElementAction($sSession, $sElement, 'click') Sleep(3000) _WD_NewTab($sSession) _WD_Navigate($sSession, "http://yahoo.com") Sleep(3000) _WD_Attach($sSession, "nbcnews.com", "URL") Sleep(3000) _WD_Attach($sSession, "yahoo.com", "URL") Sleep(1000) _WD_Window($sSession,"close") ;close tab Sleep(3000) ;these following lines will longer work, but if they're moved above _WD_Window($sSession,"close"), they work OK $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='hfs-header']/nav/div[2]/div[3]/div[1]/ul/li[1]/a") _WD_ElementAction($sSession, $sElement, 'click') Func SetupChrome() _WD_Option('Driver', 'C:\Users\Tri Tran\Documents\ChromeDriver\chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[' & """user-data-dir=C:\\ChromeAutoProfile""," & " ""disable-infobars""" & "" & '] }}}}' EndFunc ;------partial log--------------------------------------------------------------------- __WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.yahoo.com/"}... _WD_Action: {"value":"https://www.yahoo.com/"} __WD_Delete: URL=HTTP://127.0.0.1:9515/session/09ae64ce672ad64e4454647c9a4e27fe/window __WD_Delete: StatusCode=200; ResponseText={"value":["CDwindow-9E1340F16BF28DDB2E2911BDE2B2720A"]} _WD_Window: {"value":["CDwindow-9E1340F16BF28DDB2E2911BDE2B2720A"]}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/09ae64ce672ad64e4454647c9a4e27fe/element; $sData={"using":"xpath","value":"//*[@id='hfs-header']/nav/div[2]/div[3]/div[1]/ul/li[1]/a"} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_FindElement: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_FindElement ==> Webdriver Exception: HTTP status = 404 __WD_Post: URL=HTTP://127.0.0.1:9515/session/09ae64ce672ad64e4454647c9a4e27fe/element//click; $sData={"id":""} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_ElementAction: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web ... _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} +>11:34:24 AutoIt3.exe ended.rc:0 +>11:34:24 AutoIt3Wrapper Finished. >Exit code: 0 Time: 29.92 @Danp2 Here's the code that shows that after function _WD_Window($sSession,"close") is called, the $sSession is no longer valid. Link to comment Share on other sites More sharing options...
Danp2 Posted July 11, 2019 Author Share Posted July 11, 2019 @Holycow I took a look at this, and I believe there are two issues -- After calling _WD_Window($sSession,"close"), you will need to call _WD_Attach to reestablish the current tab. Haven't really thought about the ramifications, but I guess it's possible to have this done automatically following a close. Thoughts? _WD_Attach tries to save the current tab before attempting to find the designated tab. This fails, because there isn't a "current" tab as far as the webdriver is concerned, and so the function returns an error without actually trying to switch tabs Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Holycow Posted July 11, 2019 Share Posted July 11, 2019 @Danp2 I tried again with your 1st advice, take a look a the partial log attached. nothing works after close because the session id is no longer valid. and any following command would require a valid session id. expandcollapse popup#include <Constants.au3> #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.nbcnews.com/") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='content']/div/div[5]/div/div/div[2]/div/section/div[2]/div/div[1]/article/div[2]/h2/a/span") _WD_ElementAction($sSession, $sElement, 'click') Sleep(3000) _WD_NewTab($sSession) _WD_Navigate($sSession, "http://yahoo.com") Sleep(3000) _WD_Attach($sSession, "nbcnews.com", "URL") Sleep(3000) _WD_Attach($sSession, "yahoo.com", "URL") Sleep(1000) ConsoleWrite("about to close tab" & @CRLF) _WD_Window($sSession,"close") ;close tab ConsoleWrite("about to attach" & @CRLF) Sleep(3000) _WD_Attach($sSession, "nbcnews.com", "URL") Sleep(3000) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='hfs-header']/nav/div[2]/div[3]/div[1]/ul/li[1]/a") _WD_ElementAction($sSession, $sElement, 'click') Func SetupChrome() _WD_Option('Driver', 'C:\Users\Tri Tran\Documents\ChromeDriver\chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[' & """user-data-dir=C:\\ChromeAutoProfile""," & " ""disable-infobars""" & "" & '] }}}}' EndFunc ;------------------------------------------------------------------------------ _WD_Action: {"value":"https://www.yahoo.com/"} about to close tab __WD_Delete: URL=HTTP://127.0.0.1:9515/session/4a796e89537021ae025f57665f5375e0/window __WD_Delete: StatusCode=200; ResponseText={"value":["CDwindow-19B82533A363BBD2AC3A3D7FFA71BF7E"]} _WD_Window: {"value":["CDwindow-19B82533A363BBD2AC3A3D7FFA71BF7E"]}... about to attach __WD_Get: URL=HTTP://127.0.0.1:9515/session/4a796e89537021ae025f57665f5375e0/window __WD_Get: StatusCode=404; $iResult = 0; $sResponseText={"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web ... _WD_Window: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web ... _WD_Window ==> Webdriver Exception: HTTP status = 404 _WD_Attach ==> General Error __WD_Post: URL=HTTP://127.0.0.1:9515/session/4a796e89537021ae025f57665f5375e0/element; $sData={"using":"xpath","value":"//*[@id='hfs-header']/nav/div[2]/div[3]/div[1]/ul/li[1]/a"} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_FindElement: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_FindElement ==> Webdriver Exception: HTTP status = 404 __WD_Post: URL=HTTP://127.0.0.1:9515/session/4a796e89537021ae025f57665f5375e0/element//click; $sData={"id":""} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} _WD_ElementAction: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web ... _WD_ElementAction ==> Webdriver Exception: {"value":{"error":"no such window","message":"target window already closed\nfrom unknown error: web view not found\n (Session info: chrome=75.0.3770.100)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00963C43+1457219]\n\tOrdinal0 [0x008DC471+902257]\n\tOrdinal0 [0x0087D54F+513359]\n\tOrdinal0 [0x0086DA68+449128]\n\tOrdinal0 [0x0082FF2D+196397]\n\tOrdinal0 [0x00837446+226374]\n\tOrdinal0 [0x0082F4AB+193707]\n\tOrdinal0 [0x00814160+82272]\n\tOrdinal0 [0x008156E6+87782]\n\tOrdinal0 [0x008155F0+87536]\n\tGetHandleVerifier [0x00ACC781+1305121]\n\tGetHandleVerifier [0x00A14B0E+552366]\n\tGetHandleVerifier [0x00A149D6+552054]\n\tOrdinal0 [0x00971FA7+1515431]\n\tGetHandleVerifier [0x00A15036+553686]\n\tOrdinal0 [0x008F300F+995343]\n\tOrdinal0 [0x008FF65B+1046107]\n\tOrdinal0 [0x008FF7AA+1046442]\n\tOrdinal0 [0x008FE7C5+1042373]\n\tBaseThreadInitThunk [0x76396359+25]\n\tRtlGetAppContainerNamedObjectPath [0x77947A94+228]\n\tRtlGetAppContainerNamedObjectPath [0x77947A64+180]\n"}} +>13:26:41 AutoIt3.exe ended.rc:0 +>13:26:41 AutoIt3Wrapper Finished. >Exit code: 0 Time: 33.12 Link to comment Share on other sites More sharing options...
Danp2 Posted July 11, 2019 Author Share Posted July 11, 2019 @Holycow I failed in my earlier post to convey the proper message. It wasn't to give you advice; it was actually to acknowledge that you've identified an issue with how the UDF is currently coded. The session id is still valid. Run this modified version of your code to see -- expandcollapse popup#include <Constants.au3> #include "wd_core.au3" #include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.nbcnews.com/") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='content']/div/div[5]/div/div/div[2]/div/section/div[2]/div/div[1]/article/div[2]/h2/a/span") _WD_ElementAction($sSession, $sElement, 'click') _WD_NewTab($sSession) _WD_Navigate($sSession, "http://yahoo.com") _WD_Attach($sSession, "nbcnews.com", "URL") Sleep(3000) _WD_Attach($sSession, "yahoo.com", "URL") Sleep(1000) $sHandles = _WD_Window($sSession,"close") ;close tab ConsoleWrite('handles=' & $sHandles & @CRLF) $oJson = Json_Decode($sHandles) $sResult = Json_Get($oJson, "[value]") _WD_Window($sSession, 'Switch', '{"handle":"' & $sResult[0] & '"}') ; Switch to the remaining tab Sleep(3000) ;these following lines will longer work, but if they're moved above _WD_Window($sSession,"close"), they work OK _WD_Attach($sSession, "nbcnews.com", "URL") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='hfs-header']/nav/div[2]/div[3]/div[1]/ul/li[1]/a") _WD_ElementAction($sSession, $sElement, 'click') Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "args":[' & """user-data-dir=C:\\ChromeAutoProfile""," & " ""disable-infobars""" & "" & '] }}}}' EndFunc Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Holycow Posted July 11, 2019 Share Posted July 11, 2019 @danp123 Thank you Dan, your change made it work now. Let me try to understand your code to see how you got this working. I appreciate for your help. Please do let me know if you have the library functions updated and I will download a new copy. Link to comment Share on other sites More sharing options...
Letraindusoir Posted July 12, 2019 Share Posted July 12, 2019 (edited) ResponseText={"value":null} ResponseText={"value":["TX0058_2","TX0058_5"]} As shown above. 1, how to determine whether ResponseText is null or non-empty? 2, how to get "TX0058_2" and "TX0058_5" in ResponseText? To put it another way: how do I convert the result of ResponseText into an array or string form? How do I use Json_Decode and Json_Get? I didn't see the detailed help file, so I didn't understand how to use these two functions. Edited July 12, 2019 by Letraindusoir 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