Skip to content

Commit e9f25a6

Browse files
Chris SimpkinsChris Simpkins
authored andcommitted
Added start-Ie command, added Css selector support
1 parent 6eac35c commit e9f25a6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Selenium.psd1

90 Bytes
Binary file not shown.

Selenium.psm1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
[System.Reflection.Assembly]::LoadFrom("$PSScriptRoot\assemblies\WebDriver.dll")
22
[System.Reflection.Assembly]::LoadFrom("$PSScriptRoot\assemblies\WebDriver.Support.dll")
3+
34
function Start-SeChrome {
45
New-Object -TypeName "OpenQA.Selenium.Chrome.ChromeDriver"
56
}
67

8+
function Start-SeIe {
9+
New-Object -TypeName "OpenQA.Selenium.IE.InternetExplorerDriver"
10+
}
11+
712
function Start-SeFirefox {
813
param([Switch]$Profile)
914

@@ -51,7 +56,9 @@ function Find-SeElement {
5156
[Parameter(ParameterSetName = "ByTagName")]
5257
$TagName,
5358
[Parameter(ParameterSetName = "ByXPath")]
54-
$XPath)
59+
$XPath,
60+
[Parameter(ParameterSetName = "ByCssSelector")]
61+
$Css)
5562

5663
Process {
5764

@@ -91,6 +98,10 @@ function Find-SeElement {
9198
if ($PSCmdlet.ParameterSetName -eq "ByXPath") {
9299
$Target.FindElements([OpenQA.Selenium.By]::XPath($XPath))
93100
}
101+
102+
if ($PSCmdlet.ParameterSetName -eq "ByCss") {
103+
$Target.FindElements([OpenQA.Selenium.By]::CssSelector($Css))
104+
}
94105
}
95106
}
96107

@@ -110,7 +121,6 @@ function Invoke-SeClick {
110121
$Element.Click()
111122
}
112123

113-
114124
}
115125

116126
function Send-SeKeys {

0 commit comments

Comments
 (0)