Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@

# 4.0.0-preview3 (Planned)
## Added / Modified
- Get-SeElementAttribute now return a hashtable instead of a pscustom object when multiple attributes are queried



## Fixes
- Get-SeElement now make use of Get-SeElementAttribute internally to query attributes.
- Get-SeElement error when using filter / attribute
- Update-SeDriver default path typo (#206)
- New-SeScreenshot documentation update (#200)
- Casing issue with Types.ps1xml filename (#203)

# 4.0.0-preview2 (Prerelease)
## Added / Modified
Expand Down
2 changes: 1 addition & 1 deletion Help/ConvertTo-SeSelenium.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ConvertTo-Selenium [-Path] <String> [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
Convert Selenium IDE .side recording file to PowerShell commands.

## EXAMPLES

Expand Down
8 changes: 4 additions & 4 deletions Help/New-SeScreenshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Take a screenshot of the current page

### Example 1
```powershell
PS C:\> New-SeScreenshot -Path 'c:\temp\Screenshot.png' -ImageFormat Png
PS C:\> $Element | New-SeScreenshot
```

Save a screenshot in PNG format at the specified location
Take a screenshot of the specified element.

## PARAMETERS

Expand All @@ -57,7 +57,7 @@ Accept wildcard characters: False
```

### -Element
{{ Fill Element Description }}
Target IWebElement.

```yaml
Type: IWebElement
Expand All @@ -72,7 +72,7 @@ Accept wildcard characters: False
```

### -InputObject
{{ Fill InputObject Description }}
Target IWebElement.

```yaml
Type: Object
Expand Down
26 changes: 25 additions & 1 deletion Output/Selenium/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@


# 4.0.0-preview3 (Planned)
## Added / Modified
- Get-SeElementAttribute now return a hashtable instead of a pscustom object when multiple attributes are queried



## Fixes
- Get-SeElement now make use of Get-SeElementAttribute internally to query attributes.
- Get-SeElement error when using filter / attribute
- Update-SeDriver default path typo (#206)
- New-SeScreenshot documentation update (#200)
- Casing issue with Types.ps1xml filename (#203)

# 4.0.0-preview2 (Prerelease)
## Added / Modified
- Get-SeElement -Filter; Add a new parameter to do additional filtering before returning. This is equivalent to doing a Where afterward but with the Get-SeElement error management logic applied before returning. (#192)
- AcceptInsecureCertificates switch added to Start-SeDriver / New-SeDriverOptions (Supported by: Chrome, Firefox, Edge) (#189)
- Chrome web drivers assemblies updated to latest version

## Fixes
- Starting Edge browser broken (#188,#195)
- custom driver options, when specified, are not used (#191,#193)
- Processes management internal logic error (#190)
- Get-SeInput not working properly with -Single switch (#186)
- Screenshots fail when attempting to screenshot the page (#187)

# 4.0.0-preview1 (Prerelease)
Note: V4 have an enormous amount of breakchanges. Most of the cmdlet have been rewriten in a way or another.
Expand Down
2 changes: 1 addition & 1 deletion Output/Selenium/Selenium.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# RequiredModules = @()

#Type files (.ps1xml) to be loaded when importing this module
TypesToProcess = @('types/Selenium.types.ps1xml')
TypesToProcess = @('types/Selenium.Types.ps1xml')

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @('formats/Selenium.format.ps1xml')
Expand Down
Binary file modified Output/Selenium/Selenium.psm1
Binary file not shown.
14 changes: 7 additions & 7 deletions Output/Selenium/en-US/Selenium-help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
</maml:description>
</command:details>
<maml:description>
<maml:para>{{ Fill in the Description }}</maml:para>
<maml:para>Convert Selenium IDE .side recording file to PowerShell commands.</maml:para>
</maml:description>
<command:syntax>
<command:syntaxItem>
Expand Down Expand Up @@ -3018,7 +3018,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Element</maml:name>
<maml:Description>
<maml:para>{{ Fill Element Description }}</maml:para>
<maml:para>Target IWebElement.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">IWebElement</command:parameterValue>
<dev:type>
Expand All @@ -3044,7 +3044,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
<maml:name>InputObject</maml:name>
<maml:Description>
<maml:para>{{ Fill InputObject Description }}</maml:para>
<maml:para>Target IWebElement.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
Expand All @@ -3071,7 +3071,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>Element</maml:name>
<maml:Description>
<maml:para>{{ Fill Element Description }}</maml:para>
<maml:para>Target IWebElement.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">IWebElement</command:parameterValue>
<dev:type>
Expand All @@ -3083,7 +3083,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
<maml:name>InputObject</maml:name>
<maml:Description>
<maml:para>{{ Fill InputObject Description }}</maml:para>
<maml:para>Target IWebElement.</maml:para>
</maml:Description>
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
<dev:type>
Expand Down Expand Up @@ -3121,9 +3121,9 @@ PS C:\&gt; $Service.ProcessId</dev:code>
<command:examples>
<command:example>
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
<dev:code>PS C:\&gt; New-SeScreenshot -Path 'c:\temp\Screenshot.png' -ImageFormat Png</dev:code>
<dev:code>PS C:\&gt; $Element | New-SeScreenshot</dev:code>
<dev:remarks>
<maml:para>Save a screenshot in PNG format at the specified location</maml:para>
<maml:para>Take a screenshot of the specified element.</maml:para>
</dev:remarks>
</command:example>
</command:examples>
Expand Down
4 changes: 0 additions & 4 deletions Public/ConvertTo-SeSelenium.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
function ConvertTo-Selenium {
<#
.SYNOPSIS
Convert Selenium IDE .side recording file to PowerShell commands.
#>
[CmdletBinding()]
param (
# Path to .side file.
Expand Down
45 changes: 10 additions & 35 deletions Public/Get-SeElement.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -92,44 +92,19 @@ function Get-SeElement {

$GetAllAttributes = $PSBoundParameters.ContainsKey('Attributes') -and $Attributes.Count -eq 1 -and $Attributes[0] -eq '*'
$MyAttributes = [System.Collections.Generic.List[String]]::new()
if ( $null -ne $Attributes) { $MyAttributes = [System.Collections.Generic.List[String]]$Attributes }

if (!$GetAllAttributes -and $Filter) {
if ( $null -ne $Attributes) { $MyAttributes = [System.Collections.Generic.List[String]]$Attributes}
$AdditionalAttributes = [regex]::Matches($Filter, '\$_\.Attributes.(\w+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) | % { $_.Groups[1].value }
$AdditionalAttributes | ForEach-Object {
if (!$MyAttributes.Contains($_)) { $MyAttributes.Add($_) }
}
$Attributes = [String[]]$MyAttributes
$AdditionalAttributes = [regex]::Matches($Filter, '\$_\.Attributes.(\w+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) | % { $_.Groups[1].value }
$AdditionalAttributes | ForEach-Object {if (!$MyAttributes.Contains($_)) { $MyAttributes.Add($_) }}
}

if ($Attributes) {

if ($GetAllAttributes) {
Foreach ($Item in $Output) {
$AllAttributes = $Driver.ExecuteScript('var items = {}; for (index = 0; index < arguments[0].attributes.length; ++index) { items[arguments[0].attributes[index].name] = arguments[0].attributes[index].value }; return items;', $Item)
$AttArray = [System.Collections.Generic.Dictionary[String, String]]::new()

Foreach ($AttKey in $AllAttributes.Keys) {
$AttArray.Add($AttKey, $AllAttributes[$AttKey])
}

Add-Member -InputObject $Item -Name 'Attributes' -Value $AttArray -MemberType NoteProperty
}
}
else {
foreach ($Item in $Output) {
$AttArray = [System.Collections.Generic.Dictionary[String, String]]::new()

foreach ($att in $Attributes) {
$attValue = $Item.GetAttribute($att)
if ($attValue -ne "") {
$AttArray.Add($att, $Item.GetAttribute($att))
}

}
Add-Member -InputObject $Item -Name 'Attributes' -Value $AttArray -MemberType NoteProperty
}
}

if ($MyAttributes.Count -gt 0) {
Foreach ($Item in $Output) {
$htAttributes = Get-SeElementAttribute -Element $Item -Name $MyAttributes
if ($htAttributes -is [String]) {$htAttributes = @{$MyAttributes[0] = $htAttributes }}
Add-Member -InputObject $Item -Name 'Attributes' -Value $htAttributes -MemberType NoteProperty
}
}

# Apply filter here
Expand Down
4 changes: 2 additions & 2 deletions Public/Get-SeElementAttribute.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Get-SeElementAttribute {
$Output.$Att = $value
}
}
[PSCustomObject]$Output
$Output
}
elseif ($ManyAttributes) {
$Output = @{}
Expand All @@ -33,7 +33,7 @@ function Get-SeElementAttribute {
$Output.$Att = $value
}
}
[PSCustomObject]$Output
$Output
}
else {
$Element.GetAttribute($Name)
Expand Down
13 changes: 4 additions & 9 deletions Public/Update-SeDriver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function Update-SeDriver {
$Path = $PSScriptRoot
if ($Path.EndsWith('Public')) { $Path = Split-Path -Path $Path } #Debugging
switch ($OS) {
'Linux' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assembiles/linux' }
'Mac' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assembiles/macos' }
'Windows' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assembiles' }
'Linux' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assemblies/linux' }
'Mac' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assemblies/macos' }
'Windows' { $AssembliesDir = Join-Path -Path $Path -ChildPath '/assemblies' }
}

}
Expand Down Expand Up @@ -59,9 +59,4 @@ function Update-SeDriver {
Write-Warning 'Not Supported Yet'
}
}





}
}
2 changes: 1 addition & 1 deletion Selenium.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# RequiredModules = @()

#Type files (.ps1xml) to be loaded when importing this module
TypesToProcess = @('types/Selenium.types.ps1xml')
TypesToProcess = @('types/Selenium.Types.ps1xml')

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @('formats/Selenium.format.ps1xml')
Expand Down