Jump to content

Recommended Posts

  • Moderators
Posted

One thing you could include, as something of a tertiary tool, would be the ChroPath plugin for all major browsers. It makes finding an element by XPath, ID or CSS incredibly easy.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted
  On 1/2/2020 at 5:48 PM, JLogan3o13 said:

One thing you could include, as something of a tertiary tool, would be the ChroPath plugin

Expand  

Done :)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

FAQ is always a good idea ;)
Maybe extend your FAQ 40 or add a new FAQ item with the different approaches you mentioned above? And add links to the threads where the concepts are explained in detail?

I think this way more users will find the FAQ.

What do you think?
 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

All are very good points.   But the most important purpose of a tutorial is to start you up with easy problems (like installation, Hello World first script), and then move on to  higher difficulties of issues.  What I like about tutorial is also the explanation of the concepts,  like what is the difference between absolute xPath and relative. Sorry if I am too simplistic. 

  • Moderators
Posted

@Nine I agree with the first half of your statement; a tutorial as something of a "Quick-Start Guide". The explanation of concepts is great, and has a lot of value, but I would simply caution throwing in too much of that at the beginning. If someone is able to pick the UDF up and quickly get up to speed using it, they are much more likely to spend the time learning about the why and how of it. If all the theory is thrown at them first, they may get frustrated and not stick with it.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

The tutorial already covers the steps "Installation" and "Concepts and Terms".
It will not cover general concepts like xPath etc. which are not unique to WebDriver. Else it would become to big and unreadable (my opinion).

The wiki is open to everyone to add or modify it. I'm just the guy who started the tutorial ;)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

btw.
Finally I need to start using WebDriver.
Will look at this in spare time (hope I find some spare time soon).

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

@Danp2 has been very helpful for beginners to learn how to use WebDriver. I'm sure he wanted to write a tutorial himself only if he had time. Thank you, @water, for initiating this project.

I would appreciate if someone could add a tutorial for use of _WD_Window, _WD_Action and _WD_ElementAction functions and compostion of $sDesiredCapabilities among other things. Though I have been using WebDriver for almost a year now, I still don't know how to use some of the "commands" in these functions.

Thnak you and I have a great expectation.

Posted

I have talked to Danp2 before starting with the tutorial  and have incorporated some of his suggestions.

I think a detailed overview of all available functions would be helpful.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 1/7/2020 at 3:53 PM, CYCho said:

I would appreciate if someone could add a tutorial for use of _WD_Window, _WD_Action and _WD_ElementAction

Expand  

That is essentially what wd_demo is supposed to be... a tutorial to demonstrate the basic functionality of these functions. That said, I don't feel that it is my job as the UDF developer to "spoon feed" you with example after example of how to call these functions and to utilize each of the available options. The ultimate answer to all of those questions is to reference the W3C specs.

For example -- Look at the function _WD_ElementAction. In the header it gives links to the specific sections of the W3C specs that it implements. Follow those links to get a better understanding of the underlying technology that the function is implementing.

Feel free to ask for input on any of these functions, but be prepared to show that you've attempted to understand them on your own. 😉

  Quote

compostion of $sDesiredCapabilities

Expand  

This is defined elsewhere (W3C specs as well as the individual webdriver consoles) and is outside the scope of this wiki entry IMO.

  • 1 year later...
Posted

I am a complete newbie to autoit coding and do agree that IE is almost dead and none of our customer portals work in it, so I need to write some code compatible with chrome or Firefox. When truing to use WD I hit a wall, that there are no materials for beginners, wiki is good start.

Can you please add some easy beginner type scripts as example? So far there is the wd_demo, but that covers just tasks, of opening a page and entering data in to active input object. 

How do I identify and click on a web button or a link?

Can you please add an example with syntax example and how to use it?

At the moment wiki has the Function name, description and some comments, but no actual syntax examples and explanations on what each part on the function is used for.

Posted

At the end of the wiki you find a reference to the example scripts thread:
"Water's thread in the Example Scripts forum - WebDriver example scripts collection"

There you'll find some scripts to play with.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 4/16/2021 at 5:58 AM, water said:

At the end of the wiki you find a reference to the example scripts thread:
"Water's thread in the Example Scripts forum - WebDriver example scripts collection"

There you'll find some scripts to play with.

Expand  

I have tried that, but there are just 1 script there and a part of other. Example of getting data from enforcmenttracker was helpful a bit, but it still has a lot of gaps. Starting fromthe fact that enforcementtracker webpage does not open so a few example screenshots would be good.

What about the syntax? For example what does $_WD_LOCATOR_ByXPath, mean and what is the data in the string after it?

Posted
  On 4/18/2021 at 10:00 PM, Sopr said:

For example what does $_WD_LOCATOR_ByXPath, mean and what is the data in the string after it?

Expand  

There is many ways of finding element in an HTML DOM structure.
Take a look here:
https://developer.mozilla.org/en-US/docs/Web/XPath
https://www.w3schools.com/xml/xpath_syntax.asp


This following (my own helpler) functions, will give you a hint:

Func _WD_Click_ByXPath($s_Session, $s_XPath, $b_Highlight = False)
;~  https://www.w3schools.com/xml/xpath_syntax.asp
    Local $s_Element = _WD_FindElement($s_Session, $_WD_LOCATOR_ByXPath, $s_XPath)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_ElementAction($s_Session, $s_Element, 'click')
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_Click_ByXPath

Func _WD_Click_ByCSSQuerySelector($s_Session, $s_CSS_Query_Selector, $b_Highlight = False)
;~  https://webdriver.io/docs/selectors/
;~  https://www.w3.org/TR/css3-selectors/#selectors
;~  https://testelka.pl/selektory-css/
;~  https://testelka.pl/selektory-w-selenium-mozliwosci-xpatha-i-cssa-na-przykladach/
    Local $s_Element = _WD_FindElement($s_Session, $_WD_LOCATOR_ByCSSSelector, $s_CSS_Query_Selector)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_ElementAction($s_Session, $s_Element, 'click')
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_Click_ByCSSQuerySelector

Func _WD_Click_ByID($s_Session, $s_Id, $b_Highlight = False)
    Local $s_Element = _WD_GetElementById($s_Session, $s_Id)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_ElementAction($s_Session, $s_Element, 'click')
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_Click_ByID

Func _WD_Click_ByName($s_Session, $s_Name, $b_Highlight = False)
    Local $s_Element = _WD_GetElementByName($s_Session, $s_Name)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_ElementAction($s_Session, $s_Element, 'click')
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_Click_ByName

Func _WD_SetElementValue_ByID($s_Session, $s_Id, $s_Value, $i_Style = Default, $b_Highlight = False)
    Local $s_Element = _WD_FindElement($s_Session, $_WD_LOCATOR_ByXPath, "//*[@id='" & $s_Id & "']")
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_SetElementValue($s_Session, $s_Element, $s_Value, $i_Style)
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_SetElementValue_ByID

Func _WD_SetElementValue_ByName($s_Session, $s_Name, $s_Value, $i_Style = Default, $b_Highlight = False)
    Local $s_Element = _WD_GetElementByName($s_Session, $s_Name)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_SetElementValue($s_Session, $s_Element, $s_Value, $i_Style)
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_SetElementValue_ByName

Func _WD_SetElementValue_ByXPath($s_Session, $s_XPath, $s_Value, $i_Style = Default, $b_Highlight = False)
    Local $s_Element = _WD_FindElement($s_Session, $_WD_LOCATOR_ByXPath, $s_XPath)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_SetElementValue($s_Session, $s_Element, $s_Value, $i_Style)
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_SetElementValue_ByXPath

Func _WD_SetElementValue_ByCSSQuerySelector($s_Session, $s_CSS_Query_Selector, $s_Value, $i_Style = Default, $b_Highlight = False)
    Local $s_Element = _WD_FindElement($s_Session, $_WD_LOCATOR_ByCSSSelector, $s_CSS_Query_Selector)
    If @error Then Return SetError(@error, @extended, $s_Element)

    If $b_Highlight Then _WD_HighlightElement($s_Session, $s_Element)
    Local $v_Result = _WD_SetElementValue($s_Session, $s_Element, $s_Value, $i_Style)
    Return SetError(@error, @extended, $v_Result)
EndFunc   ;==>_WD_SetElementValue_ByCSSQuerySelector

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 4/18/2021 at 10:00 PM, Sopr said:

getting data from enforcmenttracker was helpful a bit, but it still has a lot of gaps.

Expand  

Primary goal of the examples in AutoIt and the wiki is to explain basic use of a function - they do not cover everything. If you need to solve more complex tasks you get help at the forum.

The WebDriver UDF uses external components and definitions like XPath, external browser based drivers etc.
This means the forum and the wiki link to the relevant sources but do not explain everything in depth.

Coding with the WebDriver UDF can be a bit complex (at least when you start) but you get very good support from the forum. So keep your questions rolling :)

 

My UDFs and Tutorials:

  Reveal hidden contents

 

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
×
×
  • Create New...