Skip to content

Commit f72a236

Browse files
Danp2mlipok
andauthored
Add support for Opera browser (#213)
* Array of supported browsers * _WD_GetBrowserVersion: Eliminate hardcoding * _WD_UpdateDriver: Partial elimination of hardcoding * wd_demo.au3 Opera first commit (#214) * Expand and move Support Browsers array * Implement $_WD_BROWSER* enum * Utilize $_WD_BROWSER_Name * __WD_CapabilitiesInitialize + 'operaOptions' (#217) * __WD_CapabilitiesInitialize + 'operaOptions' * using $_WD_SupportedBrowsers * 'edge' >> 'msedge' ScriptBreakingChange * Readme update for opera (#216) * wd_core.au3 - operaOptions > goog:chromeOptions (#221) related to @Danp2 findings: #220 (comment) * added _WD_GetBrowserPath() with Opera path support (#223) * _WD_GetBrowserPath: Eliminate browser specific code * _WD_UpdateDriver: Support alternate browser location (#226) * wd_demo.au3 - SetupOpera() suplemented + fixes (#218) * Update change log (#230) * Fix [Unreleased] header * Update CHANGELOG.md * _WD_UpdateDriver: Eliminate remaining hardcoding (#231) * Expand $_WD_SupportedBrowsers * Add __WD_GetLatestWebdriverInfo * _WD_UpdateDriver: Use __WD_GetLatestWebdriverInfo * OPERA: _WD_GetBrowserVersion/Path refactoring (#235) * $_WD_ERROR_NotSupported * using $iIndex = @Extended * OPERA: _WD_UpdateDriver + __WD_UpdateExtractor (#236) * Opera final proposals (#237) Co-authored-by: Michał Lipok <mlipok@users.noreply.github.com>
1 parent 5640412 commit f72a236

File tree

6 files changed

+398
-191
lines changed

6 files changed

+398
-191
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
Go to [legend](#legend---types-of-changes) for further information about the types of changes.
1111

12+
## [Unreleased]
13+
14+
### Added
15+
16+
- Support for Opera browser
17+
- _WD_GetBrowserPath
18+
19+
### Changed
20+
21+
- __WD_ConsoleWrite: Updated to preserve @error and @extended
22+
- _WD_Startup: Added display of webdriver bit level (32 / 64)
23+
- _WD_UpdateDriver: Support alternate browser location
24+
25+
### Deprecated
26+
27+
### Fixed
28+
29+
- _WD_UpdateDriver: Unpacking webdriver executable failed on some workstations; Better error handling
30+
- _WD_GetWebDriverVersion: Resolve error `Subscript used on non-accessible variable`
31+
32+
### Removed
33+
### Security
34+
### Project
35+
1236
## [0.6.0] - 2022-02-22
1337

1438
### Added

README.md

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<h2 align="center">Welcome to <code>au3WebDriver</code></h2>
66
</p>
77

8-
[![license](https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square&logo=spdx)](https://github.com/Danp2/au3WebDriver/blob/master/LICENSE)
9-
[![contributors](https://img.shields.io/github/contributors/Danp2/au3WebDriver.svg?style=flat-square&logo=github)](https://github.com/Danp2/au3WebDriver/graphs/contributors)
8+
[![license](https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square&logo=spdx)][license]
9+
[![contributors](https://img.shields.io/github/contributors/Danp2/au3WebDriver.svg?style=flat-square&logo=github)][Contributors]
1010
![repo size](https://img.shields.io/github/repo-size/Danp2/au3WebDriver.svg?style=flat-square&logo=github)
1111
[![last commit](https://img.shields.io/github/last-commit/Danp2/au3WebDriver.svg?style=flat-square&logo=github)](https://github.com/Danp2/au3WebDriver/commits/master)
1212
[![release](https://img.shields.io/github/release/Danp2/au3WebDriver.svg?style=flat-square&logo=github)](https://github.com/Danp2/au3WebDriver/releases/latest)
@@ -17,24 +17,23 @@
1717

1818
## Description
1919

20-
This au3WebDriver UDF (project) allows to interact with any browser that supports the [W3C WebDriver specifications](https://www.w3.org/TR/webdriver/). Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
20+
This au3WebDriver UDF (project) allows to interact with any browser that supports the [W3C WebDriver specifications][W3C Webdriver]. Supporting multiple browsers via the same code base is now possible with just a few configuration settings.
2121

2222
## Documentation
2323

2424
| | Reference | Description |
2525
| :---: | :--- | :--- |
26-
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/W3C_icon.svg/212px-W3C_icon.svg.png" width="20"> | [W3C WebDriver](https://www.w3.org/TR/webdriver/) | Official W3C WebDriver standard/specification. |
27-
| 📚 | [WebDriver Wiki](https://www.autoitscript.com/wiki/WebDriver) | Further information about this UDF (project) like big picture, capabilities, troubleshooting and more. |
26+
| <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/W3C_icon.svg/212px-W3C_icon.svg.png" width="20"> | [W3C WebDriver] | Official W3C WebDriver standard/specification. |
27+
| 📚 | [WebDriver Wiki] | Further information about this UDF (project) like big picture, capabilities, troubleshooting and more. |
2828
| 📖 | Webdriver.chm | Function CHM help file that comes with this UDF (project) download. |
2929

3030
## Features
3131

3232
### *Browser support*
3333

34-
| Chrome | Edge | Firefox |
35-
| :--- | :--- | :--- |
36-
| ![Chrome48] | ![Edge48] | ![Firefox48] |
37-
34+
| Chrome | Edge | Firefox | Opera |
35+
|-------------|---------|----------------|------------|
36+
| ![Chrome48] | ![Edge48] | ![Firefox48] | ![Opera48] |
3837

3938
### *Functions*
4039

@@ -149,24 +148,26 @@ This au3WebDriver UDF (project) allows to interact with any browser that support
149148
Download and add the following mandatory Third-Party UDFs to your project folder (independent of the browser you want to automate).
150149

151150
- Mandatory ✔
152-
- [Json UDF](https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn) - Archive includes *Json.au3* & *BinaryCall.au3*.
153-
- [WinHTTP UDF](https://github.com/dragana-r/autoit-winhttp/releases/latest) - Archive includes *WinHttp.au3* & *WinHttpConstants.au3*.
151+
- [Json UDF] - Archive includes *Json.au3* & *BinaryCall.au3*.
152+
- [WinHTTP UDF] - Archive includes *WinHttp.au3* & *WinHttpConstants.au3*.
154153
- Optional ⚠
155-
- [HtmlTable2Array UDF](https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/) - Extraction of data from HTML tables to an array.
156-
- [WinHttp_WebSocket UDF](https://github.com/Danp2/autoit-websocket) - Needed for websocket CDP functionality.
154+
- [HtmlTable2Array UDF] - Extraction of data from HTML tables to an array.
155+
- [WinHttp_WebSocket UDF] - Needed for websocket CDP functionality.
157156

158-
Download and install one of the following WebDriver (depending on the browser type and version you want to automate).
157+
Download and install one of the following WebDrivers (depending on the browser type and version you want to automate).
159158

160-
| Browser | Download | WebDriver specification status |
161-
| :---: | :--- | :--- |
162-
| ![Chrome16] | [Chrome](https://sites.google.com/chromium.org/driver/downloads) | [Status](https://chromium.googlesource.com/chromium/src/+/master/docs/chromedriver_status.md) |
163-
| ![Edge16] | [Edge](https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/) | [Status](https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/) |
164-
| ![Firefox16] | [Firefox](https://github.com/mozilla/geckodriver/releases/latest) | [Status](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status) [^1] |
159+
| Browser | Download | Implementation status |
160+
|:------------:|----------------------|------------------------------|
161+
| ![Chrome16] | [Chrome][ChromeDL] | [Status][ChromeStatus] |
162+
| ![Edge16] | [Edge][EdgeDL] | [Status][EdgeStatus] |
163+
| ![Firefox16] | [Firefox][FirefoxDL] | [Status][FirefoxStatus] [^1] |
164+
| ![Opera16] | [Opera][OperaDL] | [^2] |
165165

166-
Limitation notice. [^2]
166+
Limitation notice. [^3]
167167

168168
[^1]: Login Required
169-
[^2]: Not all WebDriver functions have been implemented by each browser. Keep that in mind and check the "WebDriver specification status" for your desired WebDriver of choice.
169+
[^2]: Derived from ChromeDriver per project [ReadMe][Opera ReadMe]
170+
[^3]: Not all WebDriver functions have been fully implemented by each browser. Keep that in mind and check the "Implementation status" for your desired WebDriver of choice.
170171

171172
#### *Installation*
172173

@@ -176,14 +177,11 @@ To automate your browser, follow the following steps.
176177
2. Move the UDFs to your project folder or to a directory where AutoIt can find them.
177178
- All *wd_\*.au3* files and the Third-Party UDFs *\*.au3* should be placed in the same directory.
178179
- Otherwise you have to adjust the `#include` statements in the files.
179-
3. Move your desired WebDriver of choice to directory of the *wd_\*.au3* files.
180-
- chromedriver.exe (Chrome)
181-
- geckodriver.exe (Firefox)
182-
- msedgedriver.exe (Edge, chromium based)
180+
3. Move your desired WebDriver of choice to the directory containing the *wd_\*.au3* files.
183181

184182
#### *Usage*
185183

186-
Run [wd_demo.au3](https://github.com/Danp2/au3WebDriver/blob/master/wd_demo.au3), choose your "Browser" from the dropdown and press the "Run Demo!" button that will perform the "DemoNavigation" demo to validate your installation.
184+
Run `wd_demo.au3`, choose your "Browser" from the dropdown and press the "Run Demo!" button that will perform the "DemoNavigation" demo to validate your installation.
187185

188186
<details>
189187
<summary><i>Result example</i></summary>
@@ -211,11 +209,11 @@ Useful information about possible configurations following soon.<br>
211209

212210
## Contributing
213211

214-
Just look at [CONTRIBUTING](https://github.com/Danp2/au3WebDriver/blob/master/docs/CONTRIBUTING.md), thank you!
212+
Just look at [CONTRIBUTING], thank you!
215213

216214
## License
217215

218-
Distributed under the MIT License. See [LICENSE](https://github.com/Danp2/au3WebDriver/blob/master/LICENSE) for more information.
216+
Distributed under the MIT License. See [LICENSE] for more information.
219217

220218
## Acknowledgements
221219

@@ -230,7 +228,7 @@ Distributed under the MIT License. See [LICENSE](https://github.com/Danp2/au3Web
230228
- Thanks to [@Danp2](https://github.com/Danp2) for the project idea, creation and maintenance
231229
- Thanks to [@mLipok](https://github.com/mLipok) for his *wd_capabilities.au3*
232230
- Thanks to [@Sven-Seyfert](https://github.com/Sven-Seyfert) for the project logo
233-
- **Big thanks** to all the hard-working [contributors](https://github.com/Danp2/au3WebDriver/graphs/contributors)
231+
- **Big thanks** to all the hard-working [contributors]
234232

235233
##
236234

@@ -241,4 +239,23 @@ Distributed under the MIT License. See [LICENSE](https://github.com/Danp2/au3Web
241239
[Edge48]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png
242240
[Edge16]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_16x16.png
243241
[Firefox48]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png
244-
[Firefox16]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_16x16.png
242+
[Firefox16]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_16x16.png
243+
[Opera48]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png
244+
[Opera16]: https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_16x16.png
245+
[ChromeDL]: https://sites.google.com/chromium.org/driver/downloads
246+
[ChromeStatus]: https://chromium.googlesource.com/chromium/src/+/master/docs/chromedriver_status.md
247+
[EdgeStatus]: https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/
248+
[EdgeDL]: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
249+
[FirefoxStatus]: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
250+
[FirefoxDL]: https://github.com/mozilla/geckodriver/releases/latest
251+
[OperaDL]: https://github.com/operasoftware/operachromiumdriver/releases/latest
252+
[License]: https://github.com/Danp2/au3WebDriver/blob/master/LICENSE
253+
[Contributors]: https://github.com/Danp2/au3WebDriver/graphs/contributors
254+
[W3C WebDriver]: https://www.w3.org/TR/webdriver/
255+
[WebDriver Wiki]: https://www.autoitscript.com/wiki/WebDriver
256+
[Opera ReadMe]: https://github.com/operasoftware/operachromiumdriver/blob/master/README.md
257+
[Json UDF]: https://www.autoitscript.com/forum/topic/148114-a-non-strict-json-udf-jsmn
258+
[WinHTTP UDF]: https://github.com/dragana-r/autoit-winhttp/releases/latest
259+
[HtmlTable2Array UDF]: https://www.autoitscript.com/forum/topic/167679-read-data-from-html-tables-from-raw-html-source/
260+
[WinHttp_WebSocket UDF]: https://github.com/Danp2/autoit-websocket
261+
[CONTRIBUTING]: https://github.com/Danp2/au3WebDriver/blob/master/docs/CONTRIBUTING.md

wd_capabilities.au3

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
; Author ........: mLipok
1616
; Modified ......:
1717
; URL ...........:
18-
; Date ..........: 2021/12/07
18+
; Date ..........: 2022/02/23
1919
; ================================================================================
2020

2121
#Region - wd_capabilities.au3 - Copyright
@@ -258,13 +258,9 @@ EndFunc ;==>_WD_CapabilitiesGet
258258
; #INTERNAL_USE_ONLY# ===========================================================================================================
259259
; Name ..........: __WD_CapabilitiesInitialize
260260
; Description ...: Initialize $_WD_CAPS__API and presets for 'alwaysMatch' Or 'firstMatch'
261-
; Syntax ........: __WD_CapabilitiesInitialize($s_MatchType[, $s_BrowserType = ''])
261+
; Syntax ........: __WD_CapabilitiesInitialize($s_MatchType[, $s_BrowserName = ''])
262262
; Parameters ....: $s_MatchType - a string value. 'alwaysMatch' Or 'firstMatch'.
263-
; $s_BrowserType - [optional] a string value. Default is ''. One of:
264-
; | 'chrome'
265-
; | 'firefox'
266-
; | 'edge'
267-
; | '' an empty string
263+
; $s_BrowserName - [optional] The browser name as defined in $_WD_SupportedBrowsers. Default is ''
268264
; Return values .: None, or set @error
269265
; Author ........: mLipok
270266
; Modified ......:
@@ -273,25 +269,25 @@ EndFunc ;==>_WD_CapabilitiesGet
273269
; Link ..........:
274270
; Example .......: No
275271
; ===============================================================================================================================
276-
Func __WD_CapabilitiesInitialize($s_MatchType, $s_BrowserType = '') ; $s_MatchType = 'alwaysMatch' Or 'firstMatch'
272+
Func __WD_CapabilitiesInitialize($s_MatchType, $s_BrowserName = '') ; $s_MatchType = 'alwaysMatch' Or 'firstMatch'
277273
#Region - parameters validation
278274
;~ __WD_ConsoleWrite("! @ScriptLineNumber = " & @ScriptLineNumber & @CRLF)
279275
If Not StringInStr('alwaysMatch|firstMatch', $s_MatchType) Then _
280276
Return SetError(1)
281277
;~ __WD_ConsoleWrite("! @ScriptLineNumber = " & @ScriptLineNumber & @CRLF)
282278

283-
;~ MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONINFORMATION, "Information #" & @ScriptLineNumber, "$s_BrowserType = " & $s_BrowserType & @CRLF & "$s_MatchType = " & $s_MatchType)
279+
;~ MsgBox($MB_OK + $MB_TOPMOST + $MB_ICONINFORMATION, "Information #" & @ScriptLineNumber, "$s_BrowserName = " & $s_BrowserName & @CRLF & "$s_MatchType = " & $s_MatchType)
284280
Local $s_SpecificOptions_KeyName = ''
285-
If StringInStr($s_BrowserType, 'chrome') Then
286-
$s_SpecificOptions_KeyName = 'goog:chromeOptions'
287-
ElseIf StringInStr($s_BrowserType, 'firefox') Then
288-
$s_SpecificOptions_KeyName = 'moz:firefoxOptions'
289-
ElseIf StringInStr($s_BrowserType, 'edge') Then
290-
$s_SpecificOptions_KeyName = 'ms:edgeOptions'
291-
ElseIf $s_MatchType = 'alwaysMatch' And $s_BrowserType = '' Then
281+
282+
If $s_BrowserName <> '' Then
283+
Local $iIndex = _ArraySearch($_WD_SupportedBrowsers, StringLower($s_BrowserName), Default, Default, Default, Default, Default, $_WD_BROWSER_Name)
284+
$s_SpecificOptions_KeyName = $_WD_SupportedBrowsers[$iIndex][$_WD_BROWSER_OptionsKey]
285+
ElseIf $s_MatchType = 'alwaysMatch' And $s_BrowserName = '' Then
292286
$s_SpecificOptions_KeyName = ''
293-
ElseIf $s_MatchType = 'firstMatch' And $s_BrowserType = '' Then
287+
ElseIf $s_MatchType = 'firstMatch' And $s_BrowserName = '' Then
294288
Return SetError(2)
289+
;~ Else
290+
;~ Return SetError(3) ; this should be tested/reviewed later (@mLipok 23-02-2022)
295291
EndIf
296292
#EndRegion - parameters validation
297293

@@ -324,7 +320,7 @@ Func __WD_CapabilitiesInitialize($s_MatchType, $s_BrowserType = '') ; $s_MatchTy
324320

325321
#Region - FOR TESTING ONLY
326322
Local $s_Information = _
327-
"$s_BrowserType = " & $s_BrowserType & @CRLF & _
323+
"$s_BrowserName = " & $s_BrowserName & @CRLF & _
328324
"$s_MatchType = " & $s_MatchType & @CRLF & _
329325
"$s_SpecificOptions_KeyName = " & $s_SpecificOptions_KeyName & @CRLF & _
330326
"$i_FirstMatch_Counter = " & $i_FirstMatch_Counter & @CRLF & _

0 commit comments

Comments
 (0)