Skip to content

Commit 0230ad0

Browse files
committed
Improve the text in the A-Simple-Google-Search example.
1 parent 66115b6 commit 0230ad0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Examples/A-Simple-Google-Search.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<#
2-
.VERSION - 0.1
2+
.VERSION - 0.2
33
44
.DESCRIPTION
55
This is an example script that will show you how to use the Selenium driver to preform a simple google search.
66
Using this example script you will learn the basic usage of the Selenium powershell module.
77
Each comment line will explain the line that will come after it so you can follow it in a step by step fashion.
88
#>
99

10-
# The line below will Import-Module Selenium if it fails it will display the installation command
11-
try{Import-Module -Name Selenium -ErrorAction Stop}catch{Write-Host 'Importing the Selenium module failed. Please install it using the following command: Install-Module Selenium'}
10+
# The line below will Import-Module Selenium if it fails it will display the installation command and stop the script.
11+
try{Import-Module -Name Selenium -ErrorAction Stop}catch{Write-Host 'Importing the Selenium module failed. Please install it using the following command: Install-Module Selenium';break}
1212

1313
# Start the Selenium Chrome Driver
1414
$Driver = Start-SeChrome
1515

16-
# Next we will check if the driver is running and if it's not running we will show a message. if the driver is running we will run the commands inside the if statment
16+
# Next we will check if the driver is running and if it's not running we will show a message. If the driver is running we will run the commands inside the if statment.
1717
if($Driver){
1818
# Now that we verified that the driver is running we can start doing cool things with it.
1919

@@ -48,20 +48,20 @@ if($Driver){
4848
# Now that we can see all the keys we can send send some keys to the SearchBoxElement
4949
Send-SeKeys -Element $SearchBoxElement -Keys 'Powershell-Selenium'
5050

51-
# You can send special key strokes to the textbox, you should use the Selenium Keys enum. For example, if we wanted to send an enter key stroke, you could do it like this
51+
# You can send special key strokes to the SearchBoxElement, you should use the Selenium Keys enum. For example, if we wanted to send an enter key stroke, you could do it like this
5252
Send-SeKeys -Element $SearchBoxElement -Keys ([OpenQA.Selenium.Keys]::Enter)
5353

5454
# When working with dynamic websites, it’s often necessary to wait awhile for elements to appear on the page. By default, Selenium won’t wait and you’ll receive $null from Find-SeElement because the element isn’t there yet. There are a couple ways to work around this.
5555
# The first is to use the Wait-SeElementExists cmdlet to wait for the existence of an element in the document.
5656
# The Wait-SeElementExists will also return the element once it is found so you can use in order to wait and then find elements on the page.
5757

58-
#This command will wait for the img elements for 10 seconds and then return it to you or time out if the element wasn't found on.
58+
# This command will wait for the img elements for 10 seconds and then return it to you or time out if the element wasn't found on.
5959
$ImageElements = Wait-SeElementExists -Driver $Driver -TagName 'img' -Timeout 10
6060

61-
# Once we have the image element we can simulate a mouse click on it using the Invoke-SeClick command
61+
# Once we have the image element we can simulate a mouse click on it using the Invoke-SeClick command.
6262
Invoke-SeClick -Driver $Driver -Element $ImageElements
6363

64-
# Once we are done with the web driver and we finished with all our testing/automation we can release the driver by running the Stop-SeDriver command
64+
# Once we are done with the web driver and we finished with all our testing/automation we can release the driver by running the Stop-SeDriver command.
6565
Stop-SeDriver -Driver $Driver
6666
}
6767
# if the driver is not running we will enter the script block in the else section and display a message

0 commit comments

Comments
 (0)