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
1 hour ago, water said:

"How to attach to a running browser instance"

The answer to this question would be great, if answered positive. Especially in Chrome. 

App: Au3toCmd              UDF: _SingleScript()                             

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

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

Done :)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
2 hours ago, CYCho said:

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

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

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
On 4/16/2021 at 3:58 PM, 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.

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
24 minutes ago, Sopr said:

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

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
10 hours ago, Sopr said:

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

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...