Jump to content

WebDriver UDF - Help & Support


Recommended Posts

Return value from _WD_ElementAction

I am trying to use the WebDriver to find the rectangle of an element on a page.  The following is a function I wrote to do this, and in its current form it includes a bunch of debugging ConsoleWrite's also. 

The main issue is the return value from _WD_ElementAction.  I have read _WD_ElementAction source code and I would expect it to return a string a Json BUT when I use it i get nothing as a return.   Initially I expected the response to be 

Quote

{"value":{"height":21,"width":79,"x":8,"y":62}}

Which is what i see in the debug output.  But on closer look to the source code it seems that _WD_ElementAction may parse out the "value" and only return 

Quote

{"height":21,"width":79,"x":8,"y":62}

But in my code I get nothing as a return value. 

 

Below is my code. 

Can anyone help?  
Should I expect a response from _WD_ElementAction?
Should I expect it to be JSon?
 

Func FindElementRect($session, $elementToFind)

   $feResult = _WD_FindElement($session, $_WD_LOCATOR_ByID, $elementToFind)
   ConsoleWrite("_WD_FindElement result: " & $feResult & @CRLF)

   ConsoleWrite("**** : " & _WD_ElementAction($session, $feResult, "rect"))     ; i can see something returned here

   $eaResult = _WD_ElementAction($session, $feResult, "rect")   ; in this case eaResult is blank
   ConsoleWrite("$eaResult: " & $eaResult & @CRLF)

   ConsoleWrite("@error is: " & @error & @CRLF)                 ;  never an error

   ; per debug log this is what I expect to get
   ;{"value":{"height":21,"width":79,"x":8,"y":62}}

   $oJson = Json_Decode($eaResult)
   Local $rect[4]
   $rect[0] = Json_Get($oJson, "[value][x]")
   ConsoleWrite("top Left X: " & $rect[0] & @CRLF)

   $rect[1] = Json_Get($oJson, "[value][y]")
   ConsoleWrite("top Left Y: " & $rect[1] & @CRLF)

   $rect[2] = $rect[0] + Json_Get($oJson, "[value][width]")
   ConsoleWrite("bottom right X: " & $rect[2] & @CRLF)

   $rect[3] = $rect[1] + Json_Get($oJson, "[value][height]")
   ConsoleWrite("bottom right Y: " & $rect[3] & @CRLF)

   return $rect
EndFunc

Many thanks in advance

Greg

Link to post
Share on other sites
  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is the "General Help and Support" thread for the WebDriver UDF. The UDF itself can be downloaded here. So if you have any questions, suggestions or errors please post here.

Hello @GregEisenberg You need to do this: Local $oJsonRect=_WD_ElementAction($sSession, $sElements, 'rect') ConsoleWrite("!" & Json_Get($oJsonRect, "[x]") & @CRLF) ConsoleWr

Time ago I wrote a function to extract data from  the source HTML code of tables. https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/ Seems that that fun

Posted Images

Hello @GregEisenberg You need to do this:

Local $oJsonRect=_WD_ElementAction($sSession, $sElements, 'rect')
ConsoleWrite("!" & Json_Get($oJsonRect, "[x]") & @CRLF)
ConsoleWrite("!" & Json_Get($oJsonRect, "[y]") & @CRLF)
ConsoleWrite("!" & Json_Get($oJsonRect, "[width]") & @CRLF)
ConsoleWrite("!" & Json_Get($oJsonRect, "[height]") & @CRLF)

 

 

Saludos

Edited by Danyfirex
Code tag fix
Link to post
Share on other sites

@JonnyQuy You will need to supply more details if you want further assistance. For starters --

  • Which browser are you attempting to automate?
  • Have you downloaded the correct webdriver? If yes, where did you save it?
  • Did you modify wd_test.au3 to point to the above location?
  • Is at least one of the entries in the array $aTestSuite set to True?

If all of the above check out, then run the code in Scite and post the results from the Output pane.

Link to post
Share on other sites

@Danyfirex Thank you.  I guess what makes debugging this hard is that when you assign the output of _WD_ElementAction to some local variant and then ConsoleWrite that variant - it prints nothing. You did answer my questions though and I really appreciate it.   For example in your code if you simply do 

ConsoleWrite("$oJsonRect: " & $oJsonRect & @CRLF) 

you end up with 

Quote

$oJsonRect: 

and that makes the user THINK they are getting back nothing. 

BTW:  Kudos to @Danp2 for this excellent UDF (and kudos to those who built it's dependencies too.) 

 

Link to post
Share on other sites
3 minutes ago, GregEisenberg said:

@Danyfirex Thank you.  I guess what makes debugging this hard is that when you assign the output of _WD_ElementAction to some local variant and then ConsoleWrite that variant - it prints nothing. You did answer my questions though and I really appreciate it.   For example in your code if you simply do 

ConsoleWrite("$oJsonRect: " & $oJsonRect & @CRLF)

you end up with 

and that makes the user THINK they are getting back nothing. 

BTW:  Kudos to @Danp2 for this excellent UDF (and kudos to those who built it's dependencies too.) 

 

Danyfirex beat me to the answer by seconds, so I cancelled my reply.

What happens is _WD_ElementAction's "rect" $sCommand returns a JSON Object, therefore you don't need to Json_Decode the return variable.

In the console window's debug you get back:

_WD_ElementAction: {"value": {"x":966.0,"y":19.0,"width":34.0,"height":24.0}}

That gets reduced to {"x":966.0,"y":19.0,"width":34.0,"height":24.0} because the $sResponse gets run through a JSON_Decode and Json_Get($oJSON, "[value]") before getting returned to your variable. Notice that the parent "value" is now gone from the new JSON Object. That's why you omit it when you do your own Json_Get.

Link to post
Share on other sites

 

On 12/6/2018 at 12:56 AM, Danp2 said:

@JonnyQuy You will need to supply more details if you want further assistance. For starters --

  • Which browser are you attempting to automate?
  • Have you downloaded the correct webdriver? If yes, where did you save it?
  • Did you modify wd_test.au3 to point to the above location?
  • Is at least one of the entries in the array $aTestSuite set to True?

If all of the above check out, then run the code in Scite and post the results from the Output pane.

  • I'm running for chrome browser
  • I downloaded "chromedriver_win32.zip", I saved it with the directory of wd_test.au3
  • If it is in the same directory with each other need to modify the path or not?
  • "TestAlerts", True I keep the default
Edited by JonnyQuy
Link to post
Share on other sites
_WD_Option('Driver', 'D:\AUTOIT\WebDriver UDF\WebDriver-0.1.0.10\WebDriver-0.1.0.10\chromedriver.exe')
_WD_Option('DriverParams', '--log-path=' & @ScriptDir & '\chrome.log')
_WD_Option('Port', 9515)

$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

_WD_Navigate($sSession, "http://google.com")
$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@class='gb_P']") ;"Images" link at the upper right
$sValue = _WD_ElementAction($sSession, $sElement, 'text') ;gets the text content of the node/element
ConsoleWrite('$sValue = ' & $sValue & @CRLF) ;"Images"
MsgBox(0,0,$sSession)

help me

Edited by JonnyQuy
Link to post
Share on other sites

i have Cookie: cid_ck:c27b40a4-a5c6-43ac-a5dd-4e4a4f79d082; Domain=.hotname.com; Expires=Tue, 18-Jun-2019 12:32:21 GMT; Path=/+>      ____ i get from HttpRequest
i get from: document.cookie => cid_ck:c27b40a4-a5c6-43ac-a5dd-4e4a4f79d082;
i get from  _WD_Cookies :  cid_ck","path":"/","secure":false,"value":"c27b40a4-a5c6-43ac-a5dd-4e4a4f79d082"}

how do i add cookie in _WD_Cookies($sSession, $sCommand, $sOption = '')
What do i do with $sOption ?

Edited by JonnyQuy
Link to post
Share on other sites

I have two questions (Chromedriver)

1: working off the example provided in the main thread, I can have it open chrome, log into a page (say google). The problem is when I re-start, it doesn't save the password or cookies so i have to log in every time. Is there a way to make user data persistant?

2: Every time I test my code it needs to open a new window. Is there a way to have it keep the same window between tests? So I can kill my script, start it, and just attach to chrome and continue on? Akin to _IE_Create() with tryattach set to 1. Basic attach if exists, else create new tab and navigate functionality.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to post
Share on other sites

@corgano

1 hour ago, corgano said:

working off the example provided in the main thread, I can have it open chrome, log into a page (say google). The problem is when I re-start, it doesn't save the password or cookies so i have to log in every time. Is there a way to make user data persistant?

From http://chromedriver.chromium.org/capabilities --

Quote

Use custom profile (also called user data directory)

By default, ChromeDriver will create a new temporary profile for each session. At times you may want to set special preferences or just use a custom profile altogether. If the former, you can use the 'chrome.prefs' capability (described later below) to specify preferences that will be applied after Chrome starts. If the latter, you can use the user-data-dir Chrome command-line switch to tell Chrome which profile to use

I haven't actually done this, so you will need to work out the correct way to implement in Autoit.

1 hour ago, corgano said:

Every time I test my code it needs to open a new window. Is there a way to have it keep the same window between tests? So I can kill my script, start it, and just attach to chrome and continue on? Akin to _IE_Create() with tryattach set to 1. Basic attach if exists, else create new tab and navigate functionality.

I know this is possible in Firefox, but unsure if you can do this in Chrome. Please report back if you successfully find a way to do this.

Link to post
Share on other sites
4 hours ago, Danp2 said:

@corgano

From http://chromedriver.chromium.org/capabilities --

I haven't actually done this, so you will need to work out the correct way to implement in Autoit.

 

IT looks like it should be
_WD_Option('DriverParams', '--user-data-dir='&@ScriptDir&'\userdata\ --log-path=' & @ScriptDir & '\chrome.log')
The chrome.log is created right, but the user data dir isn't created or used if it exists. Any ideas?

Edit:
image.png.f7586113bb9c1c01781873e66cc50dee.png
This leads me to believe it's not a command line peram, but it's stated here: http://chromedriver.chromium.org/capabilities
That it is possible. Where would I go to ask about it?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to post
Share on other sites

You have to put it into ChromeOptions, which is part of the $sDesiredCapabilities string that is passed to _WD_CreateSession. I would suggest trying something like this --

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args": [--user-data-dir='&@ScriptDir&'\userdata]}}}}'

 

Link to post
Share on other sites

Damnit, I literally just got it

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"chromeOptions": {"w3c": true, "args":["user-data-dir=userData"] } }}}'

However using @scriptdir didn't work for me. simply having =userData worked though.

What about hving a persistent window and just re-attaching to it? any ideas?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to post
Share on other sites
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Danp2
      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/
      HtmlTable2Array UDF (optional) https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/
      WebDriver for desired browser
      Chrome WebDriver https://sites.google.com/a/chromium.org/chromedriver/downloads FireFox WebDriver https://github.com/mozilla/geckodriver/releases Edge WebDriver https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ Source Code
      You will always be able to find the latest version in the GitHub Repo 
      Help / Support
      See the wiki for details on the UDF --
      https://www.autoitscript.com/wiki/WebDriver
      Please post any questions, suggestions or errors in the GH&S thread.
      https://www.autoitscript.com/forum/topic/205553-webdriver-udf-help-support-iii/
      Previous support threads (Closed)
      https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/
      https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/
       
    • By mLipok
      wd_capabilities.au3 UDF was changed/modified/refactored .... and commited/merged (02-12-2021) to https://github.com/Danp2/WebDriver

      WARNING: Before you start using this UDF be sure you download the recent version from: https://github.com/Danp2/WebDriver
       
      ==================================================================================================

      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 Hermes
      Hi, I am trying to select elements in print page (dialog window) for a specific web page. But when trying to do so, it looks like it does not allow me to do it.
      So far, this is what I have:
      _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $mainpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $mainpagebody, 2) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") Local $printbutton = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "img.print-button") _WD_ElementAction($sSession, $printbutton, 'click') _WD_LoadWait($sSession) Sleep(3000) _WD_WaitElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") Local $printpagebody = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "body") _WD_HighlightElement($sSession, $printpagebody, 2) The script above highlights the main web page "body" element, then clicks a tag to print a specific part of the page, then it will open a print page window where i am trying to highlight the body of that print page - but it looks like it is dropping from the session because it opens up another chrome page chrome://print.
       
      Below is the output log:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"img.print-link"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element/eb9e4673-4dec-4d4c-be6a-b7967743394b/click; $sData={"id":"eb9e4673-4dec-4d4c-be6a-b7967743394b"} __WD_Post: StatusCode=200; ResponseText={"value":null}... _WD_ElementAction: {"value":null}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"eb9e4673-4dec-4d4c-be6a-b7967743394b"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}... __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"return document.readyState", "args":[]} __WD_Post: StatusCode=500; ResponseText={"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... __WD_Post ==> Webdriver Exception: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00C63733+2504499]\n\tOrdinal0 [0x00BFC401+2081793]\n\tOrdinal0 [0x00B024F0+1058032]\n\tOrdinal0 [0x00B55685+1398405]\n\tOrdinal0 [0x00B45E83+1334915]\n\tOrdinal0 [0x00B54CDB+1395931]\n\tOrdinal0 [0x00B45D4B+1334603]\n\tOrdinal0 [0x00B222B4+1188532]\n\tOrdinal0 [0x00B23149+1192265]\n\tGetHandleVerifier [0x00DDFB8C+1512252]\n\tGetHandleVerifier [0x00E8B0DF+2214031]\n\tGetHandleVerifier [0x00CE4BC3+484211]\n\tGetHandleVerifier [0x00CE3E69+480793]\n\tOrdinal0 [0x00C0218D+2105741]\n\tOrdinal0 [0x00C066E8+2123496]\n\tOrdinal0 [0x00C06827+2123815]\n\tOrdinal0 [0x00C0FB73+2161523]\n\tBaseThreadInitThunk [0x75EB62C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x77C11B34+1028]\n"}} _WD_ExecuteScript: {"value":{"error":"script timeout","message":"script timeout\n (Session info: chrome=92.0.4515.107)... _WD_ExecuteScript ==> Webdriver Exception: HTTP status = 500 _WD_LoadWait ==> Webdriver Exception __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/element; $sData={"using":"css selector","value":"body"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}}... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}} __WD_Post: URL=HTTP://127.0.0.1:9515/session/cd08704233a965ccbaf9292e8692c3e4/execute/sync; $sData={"script":"arguments[0].style='background: #FFFF66; border-radius: 5px; padding-left: 3px;'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"91a394f0-004c-480d-aedf-52e2b30233c6"}]} __WD_Post: StatusCode=200; ResponseText={"value":true}... _WD_ExecuteScript: {"value":true}...  
      Is it even possible to select elements in print page?

    • By Hermes
      I have Index.html where it contains a frame with a source "frame1.html". I can select/highlight elements in index.html but unable to select/highlight elements inside the frame with the src "frame1.html", the autoit output is throwing error:
      __WD_Post: URL=HTTP://127.0.0.1:9515/session/2143396006437be4005db3b84acc1496/element/8be1c3c4-5bb1-42b1-8cde-7954765cbc61/element; $sData={"using":"css selector","value":"frameset:nth-of-type(1)"} __WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\... __WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"frameset:nth-of-type(1)\"}\n (Session info: chrome=90.0.4430.212)","stacktrace":"Backtrace:\n\tOrdinal0 [0x00FCE7D3+124883]\n\tOrdinal0 [0x00FCE7B1+124849]\n\tGetHandleVerifier [0x01218688+193832]\n\tGetHandleVerifier [0x0123C478+340760]\n\tGetHandleVerifier [0x012361F1+315537]\n\tGetHandleVerifier [0x012516BA+427354]\n\tGetHandleVerifier [0x01236176+315414]\n\tGetHandleVerifier [0x0125174A+427498]\n\tGetHandleVerifier [0x0125D6EB+476555]\n\tGetHandleVerifier [0x0125154B+426987]\n\tGetHandleVerifier [0x01234FFD+310941]\n\tGetHandleVerifier [0x01235D8E+314414]\n\tGetHandleVerifier [0x01235D19+314297]\n\tGetHandleVerifier [0x012F31EC+1089676]\n\tGetHandleVerifier [0x012F17C9+1082985]\n\tGetHandleVerifier [0x012F13A3+1081923]\n\tGetHandleVerifier [0x013ED9FD+2115741]\n\tOrdinal0 [0x0111B82E+1488942]\n\tOrdinal0 [0x010B5A7D+1071741]\n\tOrdinal0 [0x010B559B+1070491]\n\tOrdinal0 [0x010B54B1+1070257]\n\tOrdinal0 [0x010EFF53+1310547]\n\tBaseThreadInitThunk [0x770662C4+36]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B69+1081]\n\tRtlSubscribeWnfStateChangeNotification [0x776B1B34+1028]\n"}} Auto IT Script:
      #Include "wd_core.au3" #Include "wd_helper.au3" Local $sDesiredCapabilities, $sSession SetupChrome() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'index.html') _WD_LoadWait($sSession) Local $index = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)") Local $index1 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index) Local $index2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frame:nth-of-type(1)", $index1) Local $index3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByCSSSelector, "frameset:nth-of-type(1)", $index2) _WD_HighlightElement($sSession, $index2, 1) _WD_HighlightElement($sSession, $index3, 1) _WD_Shutdown() 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":["start-maximized","disable-infobars"]}}}}' EndFunc ;==>SetupChrome  

      frame1.html index.html
    • By Hermes
      Hi, sometimes when I run my script in GUI (SciTe Editor) or as an executable file, the chrome driver launches but the chrome browser does not but when I re-run the script again - chrome driver launches and so does the browser. Here is the error that I'm getting:
      __WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver... __WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver _WD_CreateSession: WinHTTP request timed out before Webdriver _WD_CreateSession ==> Webdriver Exception: HTTP status = 0 Just wondering if there's a way to re-launch both the driver and browser without having to rerun the script/executable.
       
       
×
×
  • Create New...