Description | Features | Getting started | Configuration | Contributing | License | Acknowledgements
The project "autoit-webdriver-boilerplate" can be used as quick entry point for the awesome au3WebDriver project by @Danp2 (and @mlipok). The intention is, give people a easy start with WebDriver for AutoIt.
The different kinds of examples, are (and will be) separated in different branches of the repository. In this overview you basically can see which branch contains which example of WebDriver actions. Some examples and their code could be implemented in a shorter way, but this is made by design and follows a educational purpose.
⚠ In case of 🔴 broken examples, I try to fix them as soon as possible. Sometimes Google restricts actions on their pages (e.g. google search, google translator), so it's not always feasible to address all needs.
Branch | Description of the WebDriver actions |
Test Chrome |
Test Firefox |
Test MSEdge |
Browser automation flow (steps) |
Websites in use |
---|---|---|---|---|---|---|
main |
> open website > confirm cookie consent dialog > navigate between pages > get table texts |
🟢 2025-03-28 v134.0.6998.178 |
🟢 2025-03-28 v136.0.4.7 |
🟢 2025-03-28 v134.0.3124.93 |
jump to steps | https://www.w3schools.com/ |
fill-form-take-screenshot |
> open website > navigate to specific area > fill a form > take screenshots |
🟢 2025-03-28 v134.0.6998.178 |
🟢 2025-03-28 v136.0.4.7 |
🟢 2025-03-28 v134.0.3124.93 |
jump to steps | https://demoqa.com/ |
google-search |
> open website > confirm cookie consent dialog > enter search query > choose specific match by text |
🟢 2025-03-28 v134.0.6998.178 |
🔴 2025-03-28 v136.0.4.7 1 |
🟢 2025-03-28 v134.0.3124.93 |
jump to steps | https://www.google.de/ |
multiple-browser-tabs |
> open website > open three more websites in separate browser tabs > do actions (screenshots) for each tabs > navigate through tabs, close tabs |
🟢 2025-03-28 v134.0.6998.178 |
🟢 2025-03-28 v136.0.4.7 |
🟢 2025-03-28 v134.0.3124.93 |
jump to steps | https://github.com/sven-seyfert/autoit-webdriver-boilerplate https://www.autoitscript.com/wiki/WebDriver#FAQ https://autoit.de https://pkg.go.dev |
In file .\src\common\webdriver-actions-handler.au3
you can find the following functions which should help you in terms of browser automation actions. These functions are used in the different branches and especially in the _Steps()
function and their subfunctions (entry point of the browser automation).
Area | Function | Purpose |
---|---|---|
Navigation |
||
_NavigateTo($sUrl) | Open the specific URL. | |
_OpenNewTab() | Open new tab and switch to the newly created tab context. | |
_PreviousTab() | Switch to previous (left) tab with context switch. | |
_NextTab($bShouldClose = False) | Switch to next (right) tab with context switch. | |
_CloseTab() | Close current active tab and switch to next (right) tab, with context. | |
_BrowserBack() | Make a browser history back action (backward arrow). | |
_GetCurrentBrowserTabHandle() | (internal) Get the active browser tab handle, to deal with tab navigation. | |
_GetBrowserTabHandles() | (internal) Get handles of all browser tabs, to deal with tab navigation. | |
_SwitchTab($sHandle) | (internal) Switch to tab handle context. | |
Elements |
||
_ExistsElement($sSelector) | Returns the boolean statement about whether an element exists or not. | |
_FindElement($sSelector) | Get element id (UUID) which is necessary to interact with the DOM elements. | |
_FindElements($sSelector) | Get a list of elements (of UUIDs) for further interactions (see "_FindElement"). | |
_ClickElement($sSelector) | Click DOM element by selector. | |
_GetElementText($sSelector) | Get the text of the specific DOM element. | |
_GetElementsTexts($sSelector) | Get a list of texts of the specific DOM elements. | |
_SetElementText($sSelector, $sValue) | Set text to a element like an input field. | |
_WaitForVisible($sSelector) | Wait until a element is visible. | |
Screenshot |
||
_TakeScreenshot() | Create a screenshot of the whole browser window and save this screenshot in the output directory. | |
_TakeElementScreenshot($sSelector) | Create a screenshot of a specific area/element and save this screenshot in the output directory. | |
_CreateScreenshotFile($sResponse) | (internal) Write screenshot data to output directory. | |
iFrames |
||
_EnterIFrame($sSelector) | Move context to an iFrame. | |
_LeaveIFrame() | Leave the context of the previous entered iFrame (move out). |
As assumption, your "browser" of choice which should be automated, have to be installed on your system. Not the "driver" (chromedriver.exe, geckodriver.exe etc.), your browser.
Fork or clone the repository. Alternatively you can download the latest release package. That should be all 😀 .
Q: How to clone a specific branch?
A: If you want to get the "multiple-browser-tabs" branch, simply use
git clone --branch multiple-browser-tabs https://github.com/sven-seyfert/autoit-webdriver-boilerplate.git`
Open the project in your editor/IDE and navigate to folder .\src
. Open main.au3
, check and adjust the values of function _SetGlobalValues()
and run the program. By default, in case you fulfill the preconditions, the driver should start and should execute some simple webdriver actions like described in the features section (for the specific branch).
Adjust the _Steps()
function content in .\src\website-steps-handler.au3
to your requirements and goals. Use the prepared wrapper functions in .\src\common\webdriver-actions-handler.au3
and in as best case, you also want to follow the POM (page object model) structure like prepared too.
🎬 A video crash course on how to use this project is available on Youtube, see playlist WebDriver. The videos are in german, but ⚠ I plan to recreate them in english too.
Adjust the content/values of function _SetGlobalValues()
in .\src\main.au3
.
Func _SetGlobalValues()
$mConfig.Driver = 'firefox' ; chrome|firefox|msedge
$mConfig.IsHeadlessMode = False ; False|True
$mConfig.IgnoreSSLAndCerts = False ; False|True
$mConfig.LocatorStrategy = Null ; will be set in function "_SetLocatorStrategy()", default is XPath
$mConfig.Delay = 300 ; delay for supporting a robust waiting behavior (page load, clicks, texts etc.)
$mConfig.BrowserWidth = 1600 ; or 1920, etc.
$mConfig.BrowserHeight = 900 ; or 1080, etc.
$mConfig.BrowserMode = 'size' ; fullscreen|maximize|size (default is 'size' which applies .BrowserWidth and .BrowserHeight)
; This is the default installation path, change this in case it's another on your system.
$mConfig.FirefoxBinary = 'C:\Program Files\Mozilla Firefox\firefox.exe'
; Shutdown webdriver on find element error (default is True).
$mConfig.TeardownOnFindElementError = True
; No shutdown of the webdriver on end of the execution (default is False).
; If set to "True", the browser keeps open, but you have to close the
; driver console manually in this case, to shutdown the driver session
; which close the browser.
$mConfig.NoTeardownOnEnd = False
EndFunc
I really appreciate 😀 any kind of suggestions, recommendations, ideas and of course BUG reports on GitHub via Issues. Don't hesitate to open up an issue and let's discuss the possibilies.
Otherwise fork the repository (project), create a feature branch and then create a pull request (PR) to be merged. I try to review the PR as soon as possible.
It would be great if you:
- Try to stick to the commit schema you see in the commit history.
- Try to structure your code as readable and clean as possible, because it's important to me to have maintainable code in the repository. However, I'll be happy to discuss these aspects with you in a PR if needed.
- The CHANGELOG.md file don't has to be adjusted by you. I will add your commit(s) their by an automatism when it comes to merge the PR.
- Don't forget to adjust the README.md file, in case it's necessary.
Thank you for your contribution 🤝 .
Copyright (c) 2025 Sven Seyfert (SOLVE-SMART)
Distributed under the MPL-2.0 License. See LICENSE for more information.
- Opportunity by GitHub
- Badges by Shields
- Thanks to the authors, maintainers and contributers of the various projects and UDFs
- lib/au3WebDriver/wd_*.au3 by @Danp2 and @mLipok (License: MIT)
- lib/json/*.au3 by @Ward, @Jos and @TheXMan (License: Unlicense)
- lib/winHttp/*.au3 by @dragana-r (@trancexx) (License: Apache-2.0) 2
Footnotes
-
The google search, cannot be automated with Firefox in the shown way. Firefox does not provide similar capability options like "excludeSwitches > enable-automation" or argument "--disable-blink-features=AutomationControlled" which set chromium based drivers into accepted automation mode. In case you don't set these options (switches) you cannot deal with some Google sites. ↩
-
See additional license note from Dragana R. ↩