Skip to content

Commit ee10a64

Browse files
committed
Initial Linux and MacOS support
1) Bumped version number to 1.4 2) Added the Linux and MacOS driver binaries for Chrome and Firefox and Hash Validation. 3) Added Linux and MacOS driver location detection. 4) Added OS check to Start-SeEdge and Start-SeInternetExplorer Pestor test.
1 parent 30b2da0 commit ee10a64

File tree

11 files changed

+72
-18
lines changed

11 files changed

+72
-18
lines changed

Selenium.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = '.\Selenium.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.3'
15+
ModuleVersion = '1.4'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

Selenium.psm1

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
[System.Reflection.Assembly]::LoadFrom("$PSScriptRoot\assemblies\WebDriver.dll")
22
[System.Reflection.Assembly]::LoadFrom("$PSScriptRoot\assemblies\WebDriver.Support.dll")
33

4+
if($IsLinux){
5+
$AssembliesPath = "$PSScriptRoot/assemblies/linux"
6+
}
7+
elseif($IsMacOS){
8+
$AssembliesPath = "$PSScriptRoot/assemblies/macos"
9+
}
10+
411
function Start-SeChrome {
512
Param(
613
[Parameter(Mandatory = $false)]
@@ -33,7 +40,13 @@ function Start-SeChrome {
3340
if (!$HideVersionHint) {
3441
Write-Host "Download the right chromedriver from 'http://chromedriver.chromium.org/downloads'" -ForegroundColor Yellow
3542
}
36-
New-Object -TypeName "OpenQA.Selenium.Chrome.ChromeDriver" -ArgumentList $Chrome_Options
43+
44+
if($IsLinux -or $IsMacOS){
45+
New-Object -TypeName "OpenQA.Selenium.Chrome.ChromeDriver" -ArgumentList $AssembliesPath,$Chrome_Options
46+
}
47+
else{
48+
New-Object -TypeName "OpenQA.Selenium.Chrome.ChromeDriver" -ArgumentList $Chrome_Options
49+
}
3750
}
3851

3952
function Start-SeInternetExplorer {
@@ -52,14 +65,23 @@ function Start-SeFirefox {
5265
$ProfilePath = Join-Path $PSScriptRoot "Assets\ff-profile\rust_mozprofile.YwpEBLY3hCRX"
5366
$firefoxProfile = New-Object OpenQA.Selenium.Firefox.FirefoxProfile -ArgumentList ($ProfilePath)
5467
$firefoxProfile.WriteToDisk()
55-
New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver" -ArgumentList $firefoxProfile
68+
if($IsLinux -or $IsMacOS){
69+
New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver" -ArgumentList $AssembliesPath,$firefoxProfile
70+
}
71+
else{
72+
New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver" -ArgumentList $firefoxProfile
73+
}
5674
}
5775
else {
58-
$Driver = New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver"
59-
$Driver.Manage().Timeouts().ImplicitWait = [TimeSpan]::FromSeconds(10)
60-
$Driver
76+
if($IsLinux -or $IsMacOS){
77+
$Driver = New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver" -ArgumentList $AssembliesPath
78+
}
79+
else{
80+
$Driver = New-Object -TypeName "OpenQA.Selenium.Firefox.FirefoxDriver"
81+
}
6182
}
62-
83+
$Driver.Manage().Timeouts().ImplicitWait = [TimeSpan]::FromSeconds(10)
84+
$Driver
6385
}
6486

6587
function Stop-SeDriver {

Selenium.tests.ps1

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,62 @@ Describe "Verify the Binaries SHA256 Hash" {
44
It "Check WebDriver.dll Hash"{
55
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/0ee619b1786cf5971c0f9c6ee1859497aecba93a4953cf92fea998e8eefadf3c/detection
66
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\WebDriver.dll).Hash
7-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.dll.sha256)
7+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.dll.sha256)
88
}
99

1010
It "Check WebDriver.Support.dll Hash"{
1111
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/b59ba7d0cffe43e722b13ad737cf596f030788b86b5b557cb479f0b6957cce8a/detection
1212
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\WebDriver.Support.dll).Hash
13-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.Support.dll.sha256)
13+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.Support.dll.sha256)
1414
}
1515

1616
It "Check ChromeDriver.exe Hash"{
1717
# The ChromeDriver.exe was extracted from https://chromedriver.storage.googleapis.com/76.0.3809.68/chromedriver_win32.zip its VirusTotal Scan URL - https://www.virustotal.com/gui/url/69ffe387a3fa4fbf8a108391580f1a0befb8b96b82486da4417cfcdab4add4d4/detection
18-
# ChromeDriver.exe - VirusTotal Scan URL = https://www.virustotal.com/gui/file/66cfa645f83fde41720beac7061a559fd57b6f5caa83d7918f44de0f4dd27845/detection
18+
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/66cfa645f83fde41720beac7061a559fd57b6f5caa83d7918f44de0f4dd27845/detection
1919
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\chromedriver.exe).Hash
20-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\chromedriver.exe.sha256)
20+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\chromedriver.exe.sha256)
21+
}
22+
23+
It "Check ChromeDriver Linux Hash"{
24+
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/3da69344b8b2b3b7e1497378672231a179eed6b3a0fdccbfacd3d053612e2547/detection
25+
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\linux\chromedriver).Hash
26+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\linux\chromedriver.sha256)
27+
}
28+
29+
It "Check ChromeDriver MacOS Hash"{
30+
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/57097bb65200f003152906c831ccd226ebbd5a9fd47df46f18adc29f7d01f2f0/detection
31+
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\macos\chromedriver).Hash
32+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\macos\chromedriver.sha256)
2133
}
2234

2335
It "Check GeckoDriver.exe Hash"{
2436
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/1ae81b2a6f40f7d11be3c91c4d83977ae0c0897bd5d154c02a6d869b58866b58/detection
2537
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\geckodriver.exe).Hash
26-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\geckodriver.exe.sha256)
38+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\geckodriver.exe.sha256)
39+
}
40+
41+
It "Check GeckoDriver Linux Hash"{
42+
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/4490a47280ab38f68511ac0dfff214bfad89bfd5442b1c3096c28d5372dfe2e9/detection
43+
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\linux\geckodriver).Hash
44+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\linux\geckodriver.sha256)
45+
}
46+
47+
It "Check GeckoDriver MacOS Hash"{
48+
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/1f3873a8ee0b2cb9f2918329cbdf0d65e45c0182127ea03520bec70f0dab3917/detection
49+
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\macos\geckodriver).Hash
50+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\macos\geckodriver.sha256)
2751
}
2852

2953
It "Check IEDriverServer.exe Hash"{
3054
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/a1e26b0e8cb5f8db1cd784bac71bbf540485d81e697293b0b4586e25a31a8187/detection - this driver seems to have 2 false positives and is marked as clean in the comments
3155
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\IEDriverServer.exe).Hash
32-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\IEDriverServer.exe.sha256)
56+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\IEDriverServer.exe.sha256)
3357
}
3458

3559
It "Check MicrosoftWebDriver.exe Hash"{
3660
# VirusTotal Scan URL = https://www.virustotal.com/gui/file/6e8182697ea5189491b5519d8496a3392e43741b7c0515130f2f8205881d208e/detection
3761
$Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\MicrosoftWebDriver.exe).Hash
38-
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\MicrosoftWebDriver.exe.sha256)
62+
$Hash |Should Be (Get-Content -Path $PSScriptRoot\assemblies\MicrosoftWebDriver.exe.sha256)
3963
}
4064
}
4165

@@ -62,15 +86,19 @@ Describe "Start-SeFirefox" {
6286

6387
Describe "Start-SeEdge" {
6488
Context "Should Start Edge Driver" {
65-
$Driver = Start-SeEdge
66-
Stop-SeDriver $Driver
89+
if(!$IsLinux -and !$IsMacOS){
90+
$Driver = Start-SeEdge
91+
Stop-SeDriver $Driver
92+
}
6793
}
6894
}
6995

7096
Describe "Start-SeInternetExplorer" {
7197
Context "Should Start InternetExplorer Driver" {
72-
$Driver = Start-SeInternetExplorer
73-
Stop-SeDriver $Driver
98+
if(!$IsLinux -and !$IsMacOS){
99+
$Driver = Start-SeInternetExplorer
100+
Stop-SeDriver $Driver
101+
}
74102
}
75103
}
76104

assemblies/linux/chromedriver

10.5 MB
Binary file not shown.

assemblies/linux/chromedriver.sha256

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3DA69344B8B2B3B7E1497378672231A179EED6B3A0FDCCBFACD3D053612E2547

assemblies/linux/geckodriver

8.32 MB
Binary file not shown.

assemblies/linux/geckodriver.sha256

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4490A47280AB38F68511AC0DFFF214BFAD89BFD5442B1C3096C28D5372DFE2E9

assemblies/macos/chromedriver

14.6 MB
Binary file not shown.

assemblies/macos/chromedriver.sha256

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
57097BB65200F003152906C831CCD226EBBD5A9FD47DF46F18ADC29F7D01F2F0

assemblies/macos/geckodriver

5.81 MB
Binary file not shown.

0 commit comments

Comments
 (0)