• Stars
    star
    434
  • Rank 96,646 (Top 2 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PowerShell module to run a Selenium WebDriver.

Selenium PowerShell Module

The Selenium PowerShell module allows you to automate browser interaction using the Selenium API. You can navigate to pages, find elements, click buttons, enter text and even take screenshots.

Looking for Maintainers

I haven't been able to able to keep up with the issues on this repo. If you are interested in becoming a maintainer, please let me know. - Adam

About

  • Wraps the C# WebDriver for Selenium
  • Easily execute web-based tests
  • Works well with Pester

Build Status

Installation

Note: Firefox's Latest Gecko Driver on Windows requires Microsoft Visual Studio Redistributables for the binary to run get them Here

Install-Module Selenium

OR

Import-Module "{FullPath}\selenium-powershell\Selenium.psd1"

Usage

Note: in order to use a specific driver you will need to have the brower of the driver installed on your system. For example if you use Start-SeChrome you will need to have either a Chrome or Chromium browser installed

Start a Browser Driver

# Start a driver for a browser of your choise (Chrome/Firefox/Edge/InternetExplorer)
# To start a Firefox Driver
$Driver = Start-SeFirefox 

# To start a Chrome Driver
$Driver = Start-SeChrome

# To start an Edge Driver
$Driver = Start-SeEdge

Navigate to a URL

$Driver = Start-SeFirefox 
Enter-SeUrl https://www.poshud.com -Driver $Driver

Find an Element

$Driver = Start-SeFirefox 
Enter-SeUrl https://www.poshud.com -Driver $Driver
$Element = Find-SeElement -Driver $Driver -Id "myControl"

Click on an Element/Button

$Driver = Start-SeFirefox 
Enter-SeUrl https://www.poshud.com -Driver $Driver
$Element = Find-SeElement -Driver $Driver -Id "btnSend"
Invoke-SeClick -Element $Element

Send Keystrokes

$Driver = Start-SeFirefox 
Enter-SeUrl https://www.poshud.com -Driver $Driver
$Element = Find-SeElement -Driver $Driver -Id "txtEmail"
Send-SeKeys -Element $Element -Keys "[email protected]"

Run Chrome with options

# Run Chrome in Headless mode 
$Driver = Start-SeChrome -Headless

# Run Chrome in incognito mode
$Driver = Start-SeChrome -Incognito

# Run Chrome with alternative download folder
$Driver = Start-SeChrome -DefaultDownloadPath C:\Temp

# Run Chrome and go to a URL in one command
$Driver = Start-SeChrome -StartURL 'https://www.google.com/ncr'

# Run Chrome with multiple Arguments
$Driver = Start-SeChrome -Arguments @('Incognito','start-maximized')

# Run Chrome with an existing profile.
# The default profile paths are as follows:
# Windows: C:\Users\<username>\AppData\Local\Google\Chrome\User Data
# Linux: /home/<username>/.config/google-chrome
# MacOS: /Users/<username>/Library/Application Support/Google/Chrome
$Driver = Start-SeChrome -ProfileDirectoryPath '/home/<username>/.config/google-chrome'

Find and Wait for an element

$Driver = Start-SeChrome
Enter-SeUrl 'https://www.google.com/ncr' -Driver $Driver

# Please note that with the -Wait parameter only one element can be returned at a time.
Find-SeElement -Driver $d -Wait -Timeout 10 -Css input[name='q'] 
Find-SeElement -Driver $d -Wait -Timeout 10 -Name q 

Maintainers

More Repositories

1

PoshInternals

A pure script-based PowerShell module that provides deep system analysis and configuration.
PowerShell
189
star
2

snek

PowerShell wrapper around Python for .NET to invoke Python from PowerShell
PowerShell
133
star
3

poshprotools

PowerShell Pro Tools and Universal Dashboard
PowerShell
104
star
4

pspolly

Retry, rate-limit, cache and circuit breaker cmdlets.
C#
63
star
5

pwsh-github-actions

Examples of using PowerShell in GitHub actions
PowerShell
60
star
6

awesome-covid19-resources

Awesome list of COVID19 resources
54
star
7

pinvoke

PowerShell module containing all the PInvoke signatures published by Microsoft.
PowerShell
38
star
8

sysinternals

PowerShell Crescendo module for SysInternals tools.
PowerShell
36
star
9

PSSecretStore

PowerShell wrapper around SecretStore
PowerShell
33
star
10

youtube

A collection of examples from my YouTube channel.
PowerShell
33
star
11

ud-activedirectory

Active Directory Dashboard built on Universal Dashboard.
PowerShell
33
star
12

PrettyPrint

Code formatter for PowerShell.
PowerShell
28
star
13

VSTSPosh

PowerShell Module for Accessing the Visual Studio Team Services (VSTS) REST API
PowerShell
27
star
14

AMSI

PowerShell Module for the Antimalware Scan Interface (AMSI)
PowerShell
25
star
15

PowerShellCodeDomProvider

CodeDOM Provider for PowerShell
C#
23
star
16

powershim

Invoke Windows PowerShell from PowerShell Core
PowerShell
20
star
17

Presentations

PowerShell
19
star
18

psdocker

PowerShell Module for Docker
PowerShell
6
star
19

TfsIntegrationPlatform

Copy (with some fixes) of the TFS Integration Platform by Microsoft.
C#
6
star
20

codegolf

Complete problems in the least amount of characters.
JavaScript
6
star
21

stravapwsh

PowerShell Module for Strava
PowerShell
5
star
22

vs-powershell

PowerShell Support for Visual Studio 2017 Preview
PowerShell
4
star
23

animated-lamp

Show an animated lamp.
PowerShell
3
star
24

CrescendoMiddleware

Middleware for generating Crescendo PowerShell modules from .NET command line tools.
C#
3
star
25

pscode

Demo PowerShell Editor built on AvaloniaEdit.
PowerShell
3
star
26

universal-dashboard

PowerShell Universal Dashboard
2
star
27

poshtools-documentation

Documentation for PowerShell Tools and PowerShell Pro Tools for Visual Studio
2
star
28

stickerswap

Sticker Swap Website
C#
2
star
29

udcolorpicker

Color Picker for Universal Dashboard
PowerShell
1
star
30

SCSM-ReviewActivity-Powershell

Powershell Module for SCSM ReviewActivities
PowerShell
1
star
31

IBMRQM

PowerShell
1
star
32

AzureFunctions

C#
1
star
33

UniversalDashboard.Markdown

Custom component for PowerShell Universal Dashboard to render markdown.
PowerShell
1
star
34

fluentdwelling

A PowerShell module wrapped around the FluentDwelling project by Soapbox Automation.
PowerShell
1
star
35

powershell-lsp

PowerShell Language Server Protocol Implementation for Visual Studio 2017
C#
1
star
36

LoremIpsum

PowerShell
1
star