Selenium.tests.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
Import-Module (Join-Path $PSScriptRoot "Selenium.psd1") -Force Describe "Verify the Binaries SHA256 Hash" { It "Check WebDriver.dll Hash"{ # VirusTotal Scan URL = https://www.virustotal.com/gui/file/0ee619b1786cf5971c0f9c6ee1859497aecba93a4953cf92fea998e8eefadf3c/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\WebDriver.dll).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.dll.sha256) } It "Check WebDriver.Support.dll Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/b59ba7d0cffe43e722b13ad737cf596f030788b86b5b557cb479f0b6957cce8a/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\WebDriver.Support.dll).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\WebDriver.Support.dll.sha256) } It "Check ChromeDriver.exe Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/c5c852d8f0890eb8c0b77fed623a3c36f50434552e9623e47fadf1e445f2f772/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\chromedriver.exe).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\chromedriver.exe.sha256) } It "Check ChromeDriver Linux Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/ed50bce67a54727b7bf323d588d62be699233a75300d24c92409499a9329b2e6/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\linux\chromedriver).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\linux\chromedriver.sha256) } It "Check ChromeDriver MacOS Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/6bb2996ebdeea6b2d10e6a9397ff53c394ebbaa8388087f134a4bc10f532863c/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\macos\chromedriver).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\macos\chromedriver.sha256) } It "Check GeckoDriver.exe Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/255c9d3571c86841213f49b26d176a6ad440be8c720e3c2d9226076adf4f603d/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\geckodriver.exe).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\geckodriver.exe.sha256) } It "Check GeckoDriver Linux Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/6590e3b9d9bf292c8df50b6df5bcf8a5191d999f9e48f68aa2055eb5746b2c05/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\linux\geckodriver).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\linux\geckodriver.sha256) } It "Check GeckoDriver MacOS Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/d62c2178377addeb1bb860426b2c9b10b68d2eeabf0c521529a4a6a7b1e208c4/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\macos\geckodriver).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\macos\geckodriver.sha256) } It "Check IEDriverServer.exe Hash" { # 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 $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\IEDriverServer.exe).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\IEDriverServer.exe.sha256) } It "Check MicrosoftWebDriver.exe Hash" { # VirusTotal Scan URL = https://www.virustotal.com/gui/file/6e8182697ea5189491b5519d8496a3392e43741b7c0515130f2f8205881d208e/detection $Hash = (Get-FileHash -Algorithm SHA256 -Path $PSScriptRoot\assemblies\MicrosoftWebDriver.exe).Hash $Hash | Should -Be (Get-Content -Path $PSScriptRoot\assemblies\MicrosoftWebDriver.exe.sha256) } } Describe "Start-SeChrome" { Context "Should Start Chrome Driver" { $Driver = Start-SeChrome Stop-SeDriver $Driver } } Describe "Start-SeChrome with Options" { Context "Should Start Chrome Driver with different startup options" { It "Start Chrome with StartURL" { $Driver = Start-SeChrome -StartURL 'https://github.com/adamdriscoll/selenium-powershell' Stop-SeDriver $Driver } It "Start Chrome in Headless mode" { $Driver = Start-SeChrome -Headless Stop-SeDriver $Driver } It "Start Chrome Minimize" { $Driver = Start-SeChrome -Minimize Stop-SeDriver $Driver } It "Start Chrome Maximized" { $Driver = Start-SeChrome -Maximized Stop-SeDriver $Driver } It "Start Chrome Incognito" { $Driver = Start-SeChrome -Incognito Stop-SeDriver $Driver } It "Start Chrome Fullscreen" { $Driver = Start-SeChrome -Fullscreen Stop-SeDriver $Driver } It "Start Chrome Maximized and Incognito" { $Driver = Start-SeChrome -Maximized -Incognito Stop-SeDriver $Driver } It "Start Chrome with Multiple arguments" { $Driver = Start-SeChrome -Arguments @('Incognito','start-maximized') Stop-SeDriver $Driver } } } Describe "Start-SeFirefox"{ Context "Should Start Firefox Driver" { $Driver = Start-SeFirefox Stop-SeDriver $Driver } } Describe "Start-SeFirefox with Options" { Context "Should Start Firefox Driver with different startup options" { It "Start Firefox with StartURL" { $Driver = Start-SeFirefox -StartURL 'https://github.com/adamdriscoll/selenium-powershell' Stop-SeDriver $Driver } It "Start Firefox in Headless mode" { $Driver = Start-SeFirefox -Headless Stop-SeDriver $Driver } It "Start Firefox Minimize" { $Driver = Start-SeFirefox -Minimize Stop-SeDriver $Driver } It "Start Firefox Maximized" { $Driver = Start-SeFirefox -Maximized Stop-SeDriver $Driver } It "Start Firefox PrivateBrowsing (Incognito)" { $Driver = Start-SeFirefox -PrivateBrowsing Stop-SeDriver $Driver } It "Start Firefox Fullscreen" { $Driver = Start-SeFirefox -Fullscreen Stop-SeDriver $Driver } It "Start Firefox Maximized and PrivateBrowsing (Incognito)" { $Driver = Start-SeFirefox -Maximized -PrivateBrowsing Stop-SeDriver $Driver } It "Start Firefox with Multiple arguments" { $Driver = Start-SeFirefox -Arguments @('-headless','-private') Stop-SeDriver $Driver } } } Describe "Start-SeEdge" { Context "Should Start Edge Driver" { if(!$IsLinux -and !$IsMacOS){ $Driver = Start-SeEdge Stop-SeDriver $Driver } } } Describe "Start-SeInternetExplorer" { Context "Should Start InternetExplorer Driver" { if(!$IsLinux -and !$IsMacOS){ $Driver = Start-SeInternetExplorer Stop-SeDriver $Driver } } } Describe "Get-SeCookie" { $Driver = Start-SeFirefox Context "Should get cookies from google" { Enter-SeUrl -Driver $Driver -Url "http://www.google.com" Get-SeCookie $Driver } Stop-SeDriver $Driver } Describe "Send-SeKeys" { $Driver = Start-SeFirefox Enter-SeUrl -Driver $Driver -Url "http://www.google.com/ncr" Context "Find-SeElement" { It "By Css" { $SearchInput = Find-SeElement -Driver $Driver -Css "input[name='q']" Send-SeKeys -Element $SearchInput -Keys "test" } } Stop-SeDriver $Driver } Describe "Find-SeElement Firefox" { $Driver = Start-SeFirefox Enter-SeUrl -Driver $Driver -Url "http://www.google.com/ncr" Context "Find-SeElement" { It "By Css" { $SearchInput = Find-SeElement -Driver $Driver -Css "input[name='q']" } } Context "Find-SeElement -Wait" { It "By Name"{ $SearchInput = Find-SeElement -Driver $Driver -Wait -Name q -Timeout 60 } } Stop-SeDriver $Driver } |