Skip to content

Commit 2c29696

Browse files
itfranckfsackurFreddie Sackuralaurie
authored
V4.0.0 preview3 (#209)
* Filter / Attributes check fix. * Revert "Filter / Attributes check fix." This reverts commit 30ab74b. * Get-SeElement / Get-SeElementAttribute fix / modifications * Update Get-SeElement.ps1 * Fixes * Preview3 changes * Changes merged in Master that are Preview3 related. (#208) * Fixed casing in .psd1 to match Types.ps1xml filename (#203) Co-authored-by: Freddie Sackur <[email protected]> * Corrected child path for the $OS switch (#206) Directory names were incorrect for the child path's in the $OS switch. Changed from '/assembiles' to '/assemblies' Co-authored-by: Freddie Sackur <[email protected]> Co-authored-by: Freddie Sackur <[email protected]> Co-authored-by: Alex Laurie <[email protected]> * Build + changelog Co-authored-by: Freddie Sackur <[email protected]> Co-authored-by: Freddie Sackur <[email protected]> Co-authored-by: Alex Laurie <[email protected]>
1 parent 8f06cd7 commit 2c29696

File tree

10 files changed

+59
-55
lines changed

10 files changed

+59
-55
lines changed

ChangeLog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11

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

47

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

615
# 4.0.0-preview2 (Prerelease)
716
## Added / Modified

Help/ConvertTo-SeSelenium.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ConvertTo-Selenium [-Path] <String> [<CommonParameters>]
1717
```
1818

1919
## DESCRIPTION
20-
{{ Fill in the Description }}
20+
Convert Selenium IDE .side recording file to PowerShell commands.
2121

2222
## EXAMPLES
2323

Help/New-SeScreenshot.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Take a screenshot of the current page
3434

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

40-
Save a screenshot in PNG format at the specified location
40+
Take a screenshot of the specified element.
4141

4242
## PARAMETERS
4343

@@ -57,7 +57,7 @@ Accept wildcard characters: False
5757
```
5858
5959
### -Element
60-
{{ Fill Element Description }}
60+
Target IWebElement.
6161
6262
```yaml
6363
Type: IWebElement
@@ -72,7 +72,7 @@ Accept wildcard characters: False
7272
```
7373
7474
### -InputObject
75-
{{ Fill InputObject Description }}
75+
Target IWebElement.
7676
7777
```yaml
7878
Type: Object

Output/Selenium/ChangeLog.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11

2-
2+
# 4.0.0-preview3 (Planned)
3+
## Added / Modified
4+
- Get-SeElementAttribute now return a hashtable instead of a pscustom object when multiple attributes are queried
5+
6+
7+
8+
## Fixes
9+
- Get-SeElement now make use of Get-SeElementAttribute internally to query attributes.
10+
- Get-SeElement error when using filter / attribute
11+
- Update-SeDriver default path typo (#206)
12+
- New-SeScreenshot documentation update (#200)
13+
- Casing issue with Types.ps1xml filename (#203)
14+
15+
# 4.0.0-preview2 (Prerelease)
16+
## Added / Modified
17+
- 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)
18+
- AcceptInsecureCertificates switch added to Start-SeDriver / New-SeDriverOptions (Supported by: Chrome, Firefox, Edge) (#189)
19+
- Chrome web drivers assemblies updated to latest version
20+
21+
## Fixes
22+
- Starting Edge browser broken (#188,#195)
23+
- custom driver options, when specified, are not used (#191,#193)
24+
- Processes management internal logic error (#190)
25+
- Get-SeInput not working properly with -Single switch (#186)
26+
- Screenshots fail when attempting to screenshot the page (#187)
327

428
# 4.0.0-preview1 (Prerelease)
529
Note: V4 have an enormous amount of breakchanges. Most of the cmdlet have been rewriten in a way or another.

Output/Selenium/Selenium.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
# RequiredModules = @()
7070

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

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

Output/Selenium/Selenium.psm1

-2.45 KB
Binary file not shown.

Output/Selenium/en-US/Selenium-help.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
</maml:description>
220220
</command:details>
221221
<maml:description>
222-
<maml:para>{{ Fill in the Description }}</maml:para>
222+
<maml:para>Convert Selenium IDE .side recording file to PowerShell commands.</maml:para>
223223
</maml:description>
224224
<command:syntax>
225225
<command:syntaxItem>
@@ -3018,7 +3018,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
30183018
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
30193019
<maml:name>Element</maml:name>
30203020
<maml:Description>
3021-
<maml:para>{{ Fill Element Description }}</maml:para>
3021+
<maml:para>Target IWebElement.</maml:para>
30223022
</maml:Description>
30233023
<command:parameterValue required="true" variableLength="false">IWebElement</command:parameterValue>
30243024
<dev:type>
@@ -3044,7 +3044,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
30443044
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
30453045
<maml:name>InputObject</maml:name>
30463046
<maml:Description>
3047-
<maml:para>{{ Fill InputObject Description }}</maml:para>
3047+
<maml:para>Target IWebElement.</maml:para>
30483048
</maml:Description>
30493049
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
30503050
<dev:type>
@@ -3071,7 +3071,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
30713071
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
30723072
<maml:name>Element</maml:name>
30733073
<maml:Description>
3074-
<maml:para>{{ Fill Element Description }}</maml:para>
3074+
<maml:para>Target IWebElement.</maml:para>
30753075
</maml:Description>
30763076
<command:parameterValue required="true" variableLength="false">IWebElement</command:parameterValue>
30773077
<dev:type>
@@ -3083,7 +3083,7 @@ PS C:\&gt; $Service.ProcessId</dev:code>
30833083
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
30843084
<maml:name>InputObject</maml:name>
30853085
<maml:Description>
3086-
<maml:para>{{ Fill InputObject Description }}</maml:para>
3086+
<maml:para>Target IWebElement.</maml:para>
30873087
</maml:Description>
30883088
<command:parameterValue required="true" variableLength="false">Object</command:parameterValue>
30893089
<dev:type>
@@ -3121,9 +3121,9 @@ PS C:\&gt; $Service.ProcessId</dev:code>
31213121
<command:examples>
31223122
<command:example>
31233123
<maml:title>-------------------------- Example 1 --------------------------</maml:title>
3124-
<dev:code>PS C:\&gt; New-SeScreenshot -Path 'c:\temp\Screenshot.png' -ImageFormat Png</dev:code>
3124+
<dev:code>PS C:\&gt; $Element | New-SeScreenshot</dev:code>
31253125
<dev:remarks>
3126-
<maml:para>Save a screenshot in PNG format at the specified location</maml:para>
3126+
<maml:para>Take a screenshot of the specified element.</maml:para>
31273127
</dev:remarks>
31283128
</command:example>
31293129
</command:examples>

Public/ConvertTo-SeSelenium.ps1

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
function ConvertTo-Selenium {
2-
<#
3-
.SYNOPSIS
4-
Convert Selenium IDE .side recording file to PowerShell commands.
5-
#>
62
[CmdletBinding()]
73
param (
84
# Path to .side file.

Public/Get-SeElement.ps1

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -92,44 +92,19 @@ function Get-SeElement {
9292

9393
$GetAllAttributes = $PSBoundParameters.ContainsKey('Attributes') -and $Attributes.Count -eq 1 -and $Attributes[0] -eq '*'
9494
$MyAttributes = [System.Collections.Generic.List[String]]::new()
95+
if ( $null -ne $Attributes) { $MyAttributes = [System.Collections.Generic.List[String]]$Attributes }
96+
9597
if (!$GetAllAttributes -and $Filter) {
96-
if ( $null -ne $Attributes) { $MyAttributes = [System.Collections.Generic.List[String]]$Attributes}
97-
$AdditionalAttributes = [regex]::Matches($Filter, '\$_\.Attributes.(\w+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) | % { $_.Groups[1].value }
98-
$AdditionalAttributes | ForEach-Object {
99-
if (!$MyAttributes.Contains($_)) { $MyAttributes.Add($_) }
100-
}
101-
$Attributes = [String[]]$MyAttributes
98+
$AdditionalAttributes = [regex]::Matches($Filter, '\$_\.Attributes.(\w+)', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) | % { $_.Groups[1].value }
99+
$AdditionalAttributes | ForEach-Object {if (!$MyAttributes.Contains($_)) { $MyAttributes.Add($_) }}
102100
}
103101

104-
if ($Attributes) {
105-
106-
if ($GetAllAttributes) {
107-
Foreach ($Item in $Output) {
108-
$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)
109-
$AttArray = [System.Collections.Generic.Dictionary[String, String]]::new()
110-
111-
Foreach ($AttKey in $AllAttributes.Keys) {
112-
$AttArray.Add($AttKey, $AllAttributes[$AttKey])
113-
}
114-
115-
Add-Member -InputObject $Item -Name 'Attributes' -Value $AttArray -MemberType NoteProperty
116-
}
117-
}
118-
else {
119-
foreach ($Item in $Output) {
120-
$AttArray = [System.Collections.Generic.Dictionary[String, String]]::new()
121-
122-
foreach ($att in $Attributes) {
123-
$attValue = $Item.GetAttribute($att)
124-
if ($attValue -ne "") {
125-
$AttArray.Add($att, $Item.GetAttribute($att))
126-
}
127-
128-
}
129-
Add-Member -InputObject $Item -Name 'Attributes' -Value $AttArray -MemberType NoteProperty
130-
}
131-
}
132-
102+
if ($MyAttributes.Count -gt 0) {
103+
Foreach ($Item in $Output) {
104+
$htAttributes = Get-SeElementAttribute -Element $Item -Name $MyAttributes
105+
if ($htAttributes -is [String]) {$htAttributes = @{$MyAttributes[0] = $htAttributes }}
106+
Add-Member -InputObject $Item -Name 'Attributes' -Value $htAttributes -MemberType NoteProperty
107+
}
133108
}
134109

135110
# Apply filter here

Public/Get-SeElementAttribute.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function Get-SeElementAttribute {
2323
$Output.$Att = $value
2424
}
2525
}
26-
[PSCustomObject]$Output
26+
$Output
2727
}
2828
elseif ($ManyAttributes) {
2929
$Output = @{}
@@ -33,7 +33,7 @@ function Get-SeElementAttribute {
3333
$Output.$Att = $value
3434
}
3535
}
36-
[PSCustomObject]$Output
36+
$Output
3737
}
3838
else {
3939
$Element.GetAttribute($Name)

0 commit comments

Comments
 (0)