Jump to content
Danp2

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

Recommended Posts

You are right, cause i didn't download it directly from the link you mentioned, am unable to download it, may you please re attach it for me?

 

Share this post


Link to post
Share on other sites
Posted (edited)

Best thing to do is grab the latest version on GitHub, which contains some necessary updates.

https://github.com/dragana-r/autoit-winhttp

Edit: To be clear, you don't want to download the 1.6.4.1 release, which is several years old. You want to download the latest source from the master branch.

Edited by Danp2

Share this post


Link to post
Share on other sites

Thanks i did as you said and it works, thank you. 

P.s: i will get back you later am developing a tool to automate my job related tasks and i hope that you can help. 

Share this post


Link to post
Share on other sites
<input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox">

This is a dropdown box i want to click then write some text then select the first highlighted result appeared. 

 

Here is my code

$lgnButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//span[@id='select2-headerLoginAsUserSelect-container']")
_WD_ElementAction($sSession, $lgnButton, 'click')
_WD_LoadWait($sSession, 3000)
$lgnButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@class='select2-search__field']")
_WD_ElementAction($sSession, $lgnButton, 'value', "farha")

May you please help? 
I get that error 

__WD_Post: URL=HTTP://127.0.0.1:9515/session/bd9c04d592ff2369746c0a3bf8c51e08/element/7572756e-7c6e-451d-b6cf-f6713aa65780/value; $sData={"id":"7572756e-7c6e-451d-b6cf-f6713aa65780", "text":"farha"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: 
_WD_ElementAction: {"value":{"error":"element not interactable","message":"element not interactable\n  (Session info: c...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"element not interactable","message":"element not interactable\n  (Session info:

 

Share this post


Link to post
Share on other sites

@Retaki You're mostly likely targeting the wrong element. I'm guessing that the dropdown is an instance of Select2. Their website containing document appears to be down ATM, but I imagine that you can interact with the control using _WD_ExecuteScript to programmatically select an option.

Share this post


Link to post
Share on other sites

How can i retrieve value from element? 

Like i want to make sure if the selected element having the value i want or no? 

Share this post


Link to post
Share on other sites
6 minutes ago, Retaki said:

How can i retrieve value from element? 

Like i want to make sure if the selected element having the value i want or no? 

Also how can i know if the _WD_FindElement has found the required element? like true/false? 

Share this post


Link to post
Share on other sites
1 minute ago, Retaki said:

how can i know if the _WD_FindElement has found the required element?

Check the value of @error, like this --

$sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "\\your\xpath\here")

    If @error = $_WD_ERROR_SUCCESS Then
        _WD_ElementAction($sSession, $sElement, 'click')
    EndIf

P.S. You should definitely review the function header for each of the UDF functions. I've tried to outline the return values and error codes for each one, but let me know if you find where any of the information is missing / incorrect.

Share this post


Link to post
Share on other sites

Thanks, that what i was looking for, i will keep you updated if there is anything else am stuck on it, Thank you :) 

Share this post


Link to post
Share on other sites
<tr role="row" class="even" id="Weight"><td>Weight</td><td>WEIGHT</td><td>ai4</td><td><a href="#" onclick="gsSettings.sensorsDialog('244829');" title="Edit"><i class="fa fa-edit fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsDelete('244829');" title="Delete"><i class="fa fa-trash-o fa-lg fa-operations"></i></a><a href="#" onclick="gsSettings.sensorsClone('244829');" title="Clone to other objects"><i class="fa fa-trash-o fa-lg fa-clone"></i></a></td></tr>

How i can retrive these (<td>) values? its not a value the text is written inside <td> and i want to make sure that am selecting the correct element? 

so how i can i select the (<tr>) element based on one of its <td> text?

Share this post


Link to post
Share on other sites

@Retaki I suggest that you open a new topic requesting help because this feels more like an xpath question rather than something specific to this UDF. ☺️

P.S. Be sure to include enough details so that we can better understand what you are trying to accomplish, and show us any code you've written thus far in attempts to solve the issue.

 

Share this post


Link to post
Share on other sites

@Danp2 May you please explains these data types for me? 
 

_WD_ElementAction: (Name|Rect|Text|Selected|Enabled|Displayed|Active|Attribute|Property|CSS|Clear|Click|Value|Screenshot)

 

Share this post


Link to post
Share on other sites

@Retaki These are various actions that can be performed by the _WD_ElementAction function. Examples of some of these can be found in wd_demo.au3.

If you are receiving the message "Invalid data type" when calling _WD_ElementAction, then you are most likely passing the wrong value for the $sCommand parameter.

Share this post


Link to post
Share on other sites

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

  • Similar Content

    • By water
      Internet Explorer is nearly dead, newer versions of Firefox can't any longer be automated using Stilgar's FF UDF.
      Hence more and more users (including me) need to look at automating Webbrowsers using WebDriver.
      That's why I have started to create a tutorial in the wiki.
      It should describe all necessary steps from intallation to usage.

      I'm still collecting ideas for the tutorial - that's where you come into play.
      What do you expect to see in such a tutorial?
      Which browsers should be covered (Firefox, Chrome and Edge are settled)? Any questions for the FAQ? Which (high level) coding examples do you expect (like "How to attach to a running browser instance") ... Like to see your comments
       
      ToDo-List:
      Add "Tools" section and add ChroPath plugin. Done. FAQ: "How to attach to a running browser instance". Done. Explain the difference between iuiautomation, iaccessible, autoit, webdriver. Done. The AutoIt FAQ 40 has been extended. Detailed description of each function. Done Example for "how to deal with downloading". Use function _WD_DownloadFile. Example for "how to deal with popups (alerts, print or save dialog). Use function_WD_AlertRespond to respond to a user prompt. Example for "how to deal with multiple tabs". Use functions _WD_NewTab (create a new tab), _WD_Window (close or switch to a tab) and _WD_Attach (attach to existing tab).
    • By water
      The WebDriver UDF provides a toolbox full of functions to facilitate automating Web browsers.
      Still scripts can become quite complex.
      In this thread users can post "real life" examples to show how specific tasks can be implemented.
      Note
      When posting an example please describe the purpose of the script and the WebDriver functionality used!
       
    • By Davidowicza
      Hey guys,
      I am creating my very first script that automates a browser (I usually work with program installs and database automation) and have come across an issue that I am totally stumped on. I need to click an element that gives me a drop down list box but the Xpath to the element changes with every instance of chrome I start...
      I have tried selecting the class, rect, and path but no luck. It never finds the element. (I could be doing this wrong since I am not good at HTML)
      Element I need to select:
      This is the Xpath for the last 3 instances of chrome I have run the script with:
      //*[@id="highcharts-5bp9crq-8"]/svg/g[6]/g/rect //*[@id="highcharts-fiw9szv-8"]/svg/g[6]/g/rect //*[@id="highcharts-5szkmx8-8"]/svg/g[6]/g/rect As you can see the path changes every time.
      How I am trying to select the element:
      ;Check for box element _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") MsgBox(0, "", "check for timeout") $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='highcharts-5bp9crq-8']/svg/g[6]/g") _WD_ElementAction($sSession, $sElement, 'click') Maybe someone has come across this before and found a work around without using mouseclick()
      Thanks guys, hopefully I am just very overlooking something simple and can be pointed to the right solution.
      Side Note: I wish I could share the webpage entirety, but it has sensitive information with my agency that I cannot share. If you need more, just let me know and I will try and post as much as I can.
    • By Danp2
      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.
    • By daluu
      This is kind of already posted here:
      '?do=embed' frameborder='0' data-embedContent>>
      but wanted to note this in this forum of example scripts in case some people only look in this forum for examples and not the other forums with respect to AutoIt integration or relation to Selenium WebDriver.
      So, the example in summary is: you can use Selenium WebDriver API to do AutoIt GUI automation (the ControlXyz() and WinXyz() functons, along with mouse and "send keys" functions). Although I suppose that might be opposite or counter to what most examples here are about - using AutoIt to do or control other stuff rather than using other stuff to control/run AutoIt. But regardless, it is an example implementation of a different use case for AutoIt beyond the general AutoIt community, like those who also use Selenium WebDriver and/or need to integrate Selenium with AutoIt for remote deployment.
      https://github.com/daluu/AutoItDriverServer
      with specific demo examples here:
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/CalculatorTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/calculator.py
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationTest.java
      https://github.com/daluu/AutoItDriverServer/blob/master/sample-code/SeleniumIntegrationWithAutoItDriver.py
×
×
  • Create New...