Skip to content

Commit c2b56fa

Browse files
committed
Initial Get-SeWindow/Switch-SeWindow cmdlets implementation.
1) Added Get-SeWindow cmdlets to get WindowHandlers 2) Added Switch-SeWindow cmdlets to switch between WindowHandlers (tabs)
1 parent b3623a8 commit c2b56fa

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Selenium.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ FunctionsToExport = @(
8585
"Start-SeFirefox",
8686
"Start-SeInternetExplorer",
8787
"Start-SeEdge",
88-
"Stop-SeDriver"
88+
"Stop-SeDriver",
89+
"Get-SeWindow",
90+
"Switch-SeWindow"
8991
)
9092

9193
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.

Selenium.psm1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,24 @@ function Save-SeScreenshot {
358358
$Screenshot.SaveAsFile($Path, $ImageFormat)
359359
}
360360
}
361+
362+
function Get-SeWindow {
363+
param(
364+
[Parameter(Mandatory = $true)][OpenQA.Selenium.IWebDriver]$Driver
365+
)
366+
367+
Process {
368+
$Driver.WindowHandles
369+
}
370+
}
371+
372+
function Switch-SeWindow {
373+
param(
374+
[Parameter(Mandatory = $true)][OpenQA.Selenium.IWebDriver]$Driver,
375+
[Parameter(Mandatory = $true)]$Window
376+
)
377+
378+
Process {
379+
$Driver.SwitchTo().Window($Window)|Out-Null
380+
}
381+
}

0 commit comments

Comments
 (0)