Skip to content

Commit 6cd6374

Browse files
committed
Enhanced the Find-SeElement by adding find ByCSS and ByPartialLinkText
I've Enhanced the Find-SeElement function by adding find ByCSS and ByPartialLinkText
1 parent 9a54117 commit 6cd6374

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Selenium.psm1

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ function Find-SeElement {
7171
$ClassName,
7272
[Parameter(ParameterSetName = "ByLinkText")]
7373
$LinkText,
74+
[Parameter(ParameterSetName = "ByPartialLinkText")]
75+
$PartialLinkText,
7476
[Parameter(ParameterSetName = "ByTagName")]
7577
$TagName,
7678
[Parameter(ParameterSetName = "ByXPath")]
77-
$XPath)
79+
$XPath,
80+
[Parameter(ParameterSetName = "ByCss")]
81+
$Css
82+
)
83+
7884

7985
Process {
8086

@@ -103,6 +109,10 @@ function Find-SeElement {
103109
$Target.FindElements([OpenQA.Selenium.By]::LinkText($LinkText))
104110
}
105111

112+
if ($PSCmdlet.ParameterSetName -eq "ByPartialLinkText") {
113+
$Target.FindElements([OpenQA.Selenium.By]::PartialLinkText($PartialLinkText))
114+
}
115+
106116
if ($PSCmdlet.ParameterSetName -eq "ByClassName") {
107117
$Target.FindElements([OpenQA.Selenium.By]::ClassName($ClassName))
108118
}
@@ -114,6 +124,10 @@ function Find-SeElement {
114124
if ($PSCmdlet.ParameterSetName -eq "ByXPath") {
115125
$Target.FindElements([OpenQA.Selenium.By]::XPath($XPath))
116126
}
127+
128+
if ($PSCmdlet.ParameterSetName -eq "ByCss") {
129+
$Target.FindElements([OpenQA.Selenium.By]::CssSelector($Css))
130+
}
117131
}
118132
}
119133

0 commit comments

Comments
 (0)