Skip to content

Define PSDefault members for IwebDriver #111

Closed
@itfranck

Description

@itfranck

Instead of displaying everything in list format (including page source code) in the console, a default member set should be used.

After some thoughts, I came up with the following

  • SeFriendlyName (Either session id or -Name parameter (if defined when calling Start-SeDriver)
  • SeBrowser (Current browser)
  • SeTitle (Current page title)
    -SeUrl (Current location)

image

Not only it make it all more readable but it is also faster compared to showing the whole object.

  1. Because there is less text (of course)
  2. Because getting the value of some properties after the browser is closed manually (and still in the list) is extremely slow.

For instance, Title /Url property won't be available and will timeout before returning.
This is why the use of added Note / Script properties in Start-SeDriver was done.

   Add-Member -InputObject $Driver -MemberType NoteProperty -Name 'SeFriendlyName' -Value $FriendlyName
            Add-Member -InputObject $Driver -MemberType NoteProperty -Name 'SeBrowser' -Value $SelectedBrowser
            Add-Member -InputObject $Driver -MemberType ScriptProperty -Name 'SeTitle' -Value { if ($null -ne $this.SessionId) { $this.Title } }
            Add-Member -InputObject $Driver -MemberType ScriptProperty -Name 'SeUrl' -Value { if ($null -ne $this.SessionId) { $this.Url } }

Note: As determined while working on #68 , there is a correlation between Session ID and the fact the browser is active.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions