Jump to content

WebDriver UDF (W3C compliant version) - 2024/02/19


Danp2
 Share

Recommended Posts

@HJL I believe only the Chromium-based browsers will work with the above technique. For Firefox, you would need to navigate to "about:preferences". However, it seems that Firefox doesn't update while running under a Webdriver session.

As far as why Chrome isn't autoupdating, have you checked the Task Scheduler? There should be multiple tasks that start with GoogleUpdate.

Edit: It seems that the Firefox not updating issue I mentioned above can be resolved by going to the navigating to the About:Config screen and changing "app.update.disabledForTesting" to false.

Edited by Danp2
Link to comment
Share on other sites

1 hour ago, Danp2 said:

As far as why Chrome isn't autoupdating, have you checked the Task Scheduler? There should be multiple tasks that start with GoogleUpdate.

We have gupdate and gupdatem as services running but automatic updates never come. I just found something about a group policy we have to make...


 
Link to comment
Share on other sites

3 hours ago, Danp2 said:

Edit: It seems that the Firefox not updating issue I mentioned above can be resolved by going to the navigating to the About:Config screen and changing "app.update.disabledForTesting" to false.

Is it possible to set app.update.disabledForTesting to false with autoit?

Link to comment
Share on other sites

  • 2 weeks later...

<p data-v-697ae074=""> 0.329281538020993073 <span data-v-697ae074=""> ETH </span></p>

 

having a lot of trouble finding out how to get the inner html value of 0.329281538020993073 for my script

Link to comment
Share on other sites

1 hour ago, adam said:

<p data-v-697ae074=""> 0.329281538020993073 <span data-v-697ae074=""> ETH </span></p>

having a lot of trouble finding out how to get the inner html value of 0.329281538020993073 for my script

Did you hit ENTER by mistake before entering the rest of your post?  😉  Where are the details like your script, what you've tried, the console's debug messages, and any other information that might help in trying to figure out why you are "having lots of trouble"?  :think:

Link to comment
Share on other sites

Hi @Danp2,

I am now working with the UPS website and unfortunately I cannot post a link to the page, because it is accessed after entering a username and password (that I cannot post publicly).

There is a checkbox that I cannot click using _WD_ElementAction($sSession, $sElement, 'click') -- trying with xpath and full xpath

I suspect that there is some javascript that needs to be triggered prior to clicking, but so far I have been unsuccessful and I was hoping you could help out. Below is a combination of what I found in the wd_demo and some attempts that I have made:

 

$honesty_statement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="claimHonestyStatementAgreement"]',5000,8000)
   If $honesty_statement then
      $sElementSelector = "//input[@name='claimHonestyStatementAgreement']"
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElementSelector)
      ConsoleWrite("$sElement = " & $sElement & @CRLF)
      $sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"'
      $sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":2,"type":"pointerDown"},{"button":2,"type":"pointerUp"}]}]}'
      ConsoleWrite("$sAction = " & $sAction & @CRLF)
      _WD_Action($sSession, "actions", $sAction)
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/div[2]/div[2]/div/div/main/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/input')
      _WD_ElementAction($sSession, $sElement, 'click')
   EndIf

 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/d7224439d0b531ea15bfc58cea089ef4/element; $sData={"using":"xpath","value":"//*[@id=\"claimHonestyStatementAgreement\"]"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/d7224439d0b531ea15bfc58cea089ef4/element; $sData={"using":"xpath","value":"//input[@name='claimHonestyStatementAgreement']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
$sElement = 2bf44c74-6d66-43da-949a-2e3cad0ab8b6
$sAction = {"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6","element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}},{"button":1,"type":"pointerDown"},{"button":1,"type":"pointerUp"}]}]}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/d7224439d0b531ea15bfc58cea089ef4/actions; $sData={"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6","element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}},{"button":1,"type":"pointerDown"},{"button":1,"type":"pointerUp"}]}]}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Action: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/d7224439d0b531ea15bfc58cea089ef4/element; $sData={"using":"xpath","value":"/html/body/div[2]/div[2]/div/div/main/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/input"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/d7224439d0b531ea15bfc58cea089ef4/element/2bf44c74-6d66-43da-949a-2e3cad0ab8b6/click; $sData={"id":"2bf44c74-6d66-43da-949a-2e3cad0ab8b6"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Cinput aria-describedby=\"claimHonestyStatementAgreement_error\" aria-required=\"true\" class=\"ups-checkbox-custom ng-untouched ng-pristine ng-invalid\" formcontrolname=\"claimHonestyStatementAgreement\" id=\"claimHonestyStatementAgreement\" name=\"claimHonestyStatementAgreement\" required=\"\" type=\"checkbox\" value=\"1\"> is not clickable at point (66, 219). Other element would receive the click: \u003Clabel class=\"ups-checkbox-custom-label\" for=\"claimHonestyStatementAgreement\">...\u003C/label>\n  (Session info: chrome=89.0.4389.82)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0033B963+483]\n\tGetHandleVerifier [0x0033B941+449]\n\tGetHandleVerifier [0x006E3308+3832712]\n\tGetHandleVerifier [0x00709FB1+3991601]\n\tGetHandleVerifier [0x00708D51+3986897]\n\tGetHandleVerifier [0x0070780B+3981451]\n\tGetHandleVerifier [0x00706E1C+3978908]\n\tGetHandleVerifier [0x00700199+3951129]\n\tGetHandleVerifier [0x0071B403+4062339]\n\tGetHandleVerifier [0x006FFFB6+3950646]\n\tGetHandleVerifier [0x0071B4CA+4062538]\n\tGetHandleVerifier [0x00727159+4110809]\n\tGetHandleVerifier [0x0071B2EB+4062059]\n\tGetHandleVerifier [0x006FED14+3945876]\n\tGetHandleVerifier [0x006FFBCE+3949646]\n\tGetHandleVerifier [0x006FFB59+3949529]\n\tOrdinal0 [0x002FB5CC+46540]\n\tOrdinal0 [0x002F9F53+40787]\n\tOrdinal0 [0x002F9B12+39698]\n\tGetHandleVerifier [0x00601468+2907368]\n\tGetHandleVerifier [0x004471EE+1096302]\n\tGetHandleVerifier [0x00403E8D+821005]\n\tGetHandleVerifier [0x0040396B+819691]\n\tGetHandleVerifier [0x00403881+819457]\n\tGetHandleVerifier [0x0042F463+998627]\n\tBaseThreadInitThunk [0x7551FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x76EC7C7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x76EC7C4E+238]\n"}}
_WD_ElementAction: {"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Cin...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"element click intercepted","message":"element click intercepted: Element \u003Cinput aria-describedby=\"claimHonestyStatementAgreement_error\" aria-required=\"true\" class=\"ups-checkbox-custom ng-untouched ng-pristine ng-invalid\" formcontrolname=\"claimHonestyStatementAgreement\" id=\"claimHonestyStatementAgreement\" name=\"claimHonestyStatementAgreement\" required=\"\" type=\"checkbox\" value=\"1\"> is not clickable at point (66, 219). Other element would receive the click: \u003Clabel class=\"ups-checkbox-custom-label\" for=\"claimHonestyStatementAgreement\">...\u003C/label>\n  (Session info: chrome=89.0.4389.82)","stacktrace":"Backtrace:\n\tGetHandleVerifier [0x0033B963+483]\n\tGetHandleVerifier [0x0033B941+449]\n\tGetHandleVerifier [0x006E3308+3832712]\n\tGetHandleVerifier [0x00709FB1+3991601]\n\tGetHandleVerifier [0x00708D51+3986897]\n\tGetHandleVerifier [0x0070780B+3981451]\n\tGetHandleVerifier [0x00706E1C+3978908]\n\tGetHandleVerifier [0x00700199+3951129]\n\tGetHandleVerifier [0x0071B403+4062339]\n\tGetHandleVerifier [0x006FFFB6+3950646]\n\tGetHandleVerifier [0x0071B4CA+4062538]\n\tGetHandleVerifier [0x00727159+4110809]\n\tGetHandleVerifier [0x0071B2EB+4062059]\n\tGetHandleVerifier [0x006FED14+3945876]\n\tGetHandleVerifier [0x006FFBCE+3949646]\n\tGetHandleVerifier [0x006FFB59+3949529]\n\tOrdinal0 [0x002FB5CC+46540]\n\tOrdinal0 [0x002F9F53+40787]\n\tOrdinal0 [0x002F9B12+39698]\n\tGetHandleVerifier [0x00601468+2907368]\n\tGetHandleVerifier [0x004471EE+1096302]\n\tGetHandleVerifier [0x00403E8D+821005]\n\tGetHandleVerifier [0x0040396B+819691]\n\tGetHandleVerifier [0x00403881+819457]\n\tGetHandleVerifier [0x0042F463+998627]\n\tBaseThreadInitThunk [0x7551FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x76EC7C7E+286]\n\tRtlGetAppContainerNamedObjectPath [0x76EC7C4E+238]\n"}}

 

<input aria-describedby="claimHonestyStatementAgreement_error" aria-required="true" class="ups-checkbox-custom ng-untouched ng-pristine ng-invalid" formcontrolname="claimHonestyStatementAgreement" id="claimHonestyStatementAgreement" name="claimHonestyStatementAgreement" required="" type="checkbox" value="1">

 

Link to comment
Share on other sites

@Danp2

I just tried clicking the label with the code below and was not successful.

$honesty_statement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="claimHonestyStatementAgreement"]',5000,8000)
   If $honesty_statement then
      $sElementSelector = '//*[@id="ups-main"]/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/label'
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sElementSelector)
      ConsoleWrite("$sElement = " & $sElement & @CRLF)
      $sAction = '{"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"'
      $sAction &= $sElement & '","' & $_WD_ELEMENT_ID & '":"' & $sElement & '"}},{"button":1,"type":"pointerDown"},{"button":1,"type":"pointerUp"}]}]}'
      ConsoleWrite("$sAction = " & $sAction & @CRLF)
      _WD_Action($sSession, "actions", $sAction)
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="ups-main"]/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/label')
      _WD_ElementAction($sSession, $sElement, 'click')
   EndIf

 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/79ad015c9cb560ae08a0117922451fd1/element; $sData={"using":"xpath","value":"//*[@id=\"ups-main\"]/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/label"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}}
$sElement = 9039c2a0-3817-4f3e-a17b-3dcf843bb73f
$sAction = {"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f","element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}},{"button":1,"type":"pointerDown"},{"button":1,"type":"pointerUp"}]}]}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/79ad015c9cb560ae08a0117922451fd1/actions; $sData={"actions":[{"id":"default mouse","type":"pointer","parameters":{"pointerType":"mouse"},"actions":[{"duration":100,"x":0,"y":0,"type":"pointerMove","origin":{"ELEMENT":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f","element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}},{"button":1,"type":"pointerDown"},{"button":1,"type":"pointerUp"}]}]}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_Action: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/79ad015c9cb560ae08a0117922451fd1/element; $sData={"using":"xpath","value":"//*[@id=\"ups-main\"]/div/div/ups-cou-app/div/new-claims/ng-component/div[2]/div/form/div[1]/div/label"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/79ad015c9cb560ae08a0117922451fd1/element/9039c2a0-3817-4f3e-a17b-3dcf843bb73f/click; $sData={"id":"9039c2a0-3817-4f3e-a17b-3dcf843bb73f"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
<label class="ups-checkbox-custom-label" for="claimHonestyStatementAgreement"> By selecting this box, I certify that the information provided in this submission for Claim Payment and all communications related to this request including but not limited to, statements as to the actual contents and value of items that have been lost or damaged are true and accurate to the best of my knowledge and that this request has been submitted in good faith. * </label>

 

Link to comment
Share on other sites

40 minutes ago, NSearch said:

I just tried clicking the label with the code below and was not successful.

Actually, it looks like the code ran just fine. You just didn't get the outcome that you wanted. 😉 I'm sure there's a way to automate it. Unfortunately, I don't know how I can help without more info. Maybe you could find another website that exhibits the same behavior or another page on the UPS site that I could access.

 

Link to comment
Share on other sites

Latest update just released. See below for change log.

Note: Changes to _WD_WaitElement may break your script so plan accordingly 😉

Quote

    v0.4.0.2
    - Added: _WD_GetSession
    - Changed (_WD_FrameEnter): Allow Null as valid index value
    - Changed (_WD_ElementActionEx): Added support for childCount action
    - Changed (_WD_WaitElement): Switch to single parameter for options         *** Script breaking change ***
    - Changed: _WD_ElementActionEx
        - Fixed: doubleclick and clickandhold now honor button parameter
        - Added: modifierclick
    - Changed (_WD_SetElementValue): Added "advanced" option

Edit: @mLipok pointed out an issue with _WD_SetElementValue where I left a reference to $iMethod. This has been changed on Github to the corrrect variable ($iStyle), and this correction will be included in the next release.

Edited by Danp2
Link to comment
Share on other sites

  • 4 weeks later...

Latest update just released. See below for change log.

Quote

    v0.4.0.3
    - Changed (_WD_HighlightElement): Option to remove highlight
    - Fix (_WD_SetElementValue): Corrected leftover $iMethod reference
    - Fix (_WD_FrameEnter) Properly handle Null index (mLipok)
    - Fix (_WD_SelectFiles) Properly set value of $sFuncName (mLipok)
    - Fix (_WD_ElementActionEx) Properly terminate JSON string
    - Chore (_WD_IsLatestRelease) Remove unneeded code for saving debug level (seadoggie01)
    - Chore (_WD_GetShadowRoot) Remove unused variable (seadoggie01)

 

Link to comment
Share on other sites

  • 3 months later...

Latest update just released. See below for change log.

Quote

    v0.4.1.0
    - Changed: Moved CDP-related functions to separate file (wd_cdp.au3)
    - Changed (_WD_ExecuteCDPCommand): Now supports additional browsers via WebSockets
    - Added: _WD_GetCDPSettings
    - Changed (_WD_Option): Added support for "DefaultTimeout" option (mLipok)

    v0.4.0.5
    - Changed (_WD_WaitElement): Added support for $_WD_OPTION_NoMatch (mLipok)
    - Changed (_WD_WaitElement): Always return Element ID
    - Fixed: InetRead() @error handling (mLipok)
    - Changed: Expose _WD_GetBrowserVersion and _WD_GetWebDriverVersion (mLipok)
    - Changed: Renamed _Base64Decode to __WD_Base64Decode

 

Link to comment
Share on other sites

  • 2 months later...

Latest update just released. See below for change log.

Quote

    v0.4.1.2
    - Added: _WD_CheckContext
    - Fixed (_WD_NewTab): Return error on _WD_Window failure
    - Fixed (_WD_IsLatestRelease)
        - Update regex
        - Return $_WD_ERROR_Exception if regex fails
    - Changed (_WD_ExecuteCDPCommand): Added http status check
    - Changed (__WD_DetectError): Detect unknown end point
    - Chore: Updated wd_cdp.au3
        - Rename functions so that they begin with _WD_CDP
        - Tidy code

 

Link to comment
Share on other sites

  • 1 month later...

Latest update just released. See below for change log.

Quote

v0.5.0.1
    - Added: _WD_Capabilities functions (mLipok)
    - Changed (_WD_UpdateDriver): Added ability to check for newer webdriver without performing update
    - Chore: Updated wd_demo.au3 (mLipok)
        - Au3Check compatibility
        - Script no longer exits after running selected demos
        - Demonstrate usage of new _WD_Capabilities functions
    - Changed (__WD_Sleep): Set @error to $_WD_ERROR_UserAbort in case of error (mLipok)

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 2024/02/19
  • Melba23 pinned this topic

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
 Share

×
×
  • Create New...