Actions
start
Start an instance of a browser.
1: 2: 3: 4: 5: 6: 7: |
|
!^ (aliased by url)
Go to a url.
1: 2: |
|
quit
Quit the current browser or the specified browser.
1: 2: 3: 4: 5: |
|
<< (write)
Write text to element.
1: 2: 3: 4: |
|
read
Read the text (or value or selected option) of an element.
1: 2: 3: |
|
click
Click an element via selector or text, can also click selenium IWebElements
.
1: 2: 3: |
|
doubleClick
Simulates a double click via JavaScript.
1:
|
|
ctrlClick
Click an element via selector or text while holding down the control key, can also click selenium IWebElements
.
1: 2: 3: |
|
shiftClick
Click an element via selector or text while holding down the shift key, can also click selenium IWebElements
.
1: 2: 3: |
|
rightClick
Right click an element.
1:
|
|
check
Checks a checkbox if it is not already checked.
1: 2: 3: |
|
uncheck
Unchecks a checkbox if it is not already unchecked.
1: 2: 3: |
|
--> (drag is an alias)
Drag on item to another.
1: 2: |
|
hover
Hover over an element.
1: 2: 3: 4: |
|
element
Get an element (Selenium IWebElement
) with given css selector or text (built in waits, automatically searches through iFrames
).
Most useful if you need to write some custom helpers to provide functionality that canopy does not currently have.
1: 2: 3: |
|
unreliableElement
Try to get an element without the built in reliability. Throws exception if element not found.
1:
|
|
elementWithText
Unreliably get the first element with specific text for a selector.
1:
|
|
elementWithin
Get an element by searching within another element (nested).
1:
|
|
someElement
Like element
function except it runs a Some(IWebElement)
or None
.
Read more about Option
types here.
1: 2: 3: 4: 5: 6: |
|
someElementWithin
Like elementWithin
function except it runs a Some(IWebElement)
or None
.
Read more about Option types here.
1: 2: |
|
parent
Get the parent element of provided element.
1:
|
|
someParent
Get the Some
/None
parent element of provided element.
1:
|
|
elements
The same as element except you get all elements that match the css selector or text.
1: 2: 3: 4: 5: |
|
unreliableElements
The same as elements except there is no reliability. You get an empty list if there no elements on the first try.
1:
|
|
unreliableElementsWithin
Try without reliability to get elements within an existing element.
1: 2: 3: 4: |
|
elementsWithText
Unreliably gets elements with specific text for a selector.
1:
|
|
elementsWithin
Get elements by searching within another element (nested).
1:
|
|
nth
Get the nth element.
1:
|
|
first
Get the first element.
1:
|
|
last
Get the last element.
1:
|
|
fastTextFromCSS
Effeciently get the text values for all elements matching a css selector.
1:
|
|
switchTo
Switch to an existing instance of a browser.
1: 2: 3: 4: 5: 6: |
|
switchToTab
Switch browser focus between tabs.
1:
|
|
closeTab
Close a specific tab.
1:
|
|
resize
Resize the browser to a specific size.
1:
|
|
rotate
Rotate the browser by switching the Height and Width.
1:
|
|
js
Run JavaScript in the current browser.
1: 2: |
|
screenshot
Take a screenshot and save it to the specified path with specified filename. Returns image as byte array.
1: 2: 3: |
|
sleep
Sleep for X
seconds.
1: 2: 3: 4: 5: 6: |
|
highlight
Place a border around an element to help you identify it visually, used in wip test mode.
1:
|
|
describe (aliased as puts)
Describe something in your test, currently writes description to console.
1:
|
|
waitFor
Wait until custom function is true (better alternative to sleeping X
seconds).
1: 2: 3: 4: 5: 6: |
|
waitFor2
Wait (with message) until custom function is true (better alternative to sleeping X
seconds).
1: 2: 3: |
|
waitForElement
Wait until an element with a given CSS selector appears in the DOM. This is useful when you need to wait for data being loaded and displayed.
1: 2: 3: |
|
clear
Clear the text of an element.
1:
|
|
press
Simulate a key press. Other keys can be sent by first importing OpenQA.Selenium and using the keys defined there.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: |
|
alert
Gets the current alert.
1:
|
|
acceptAlert
Accepts the current alert.
1:
|
|
dismissAlert
Dismiss the current alert.
1:
|
|
pin
Pin a browser to the left, right, or fullscreen (any browser you start is pinned right automatically).
1: 2: 3: |
|
tile
Tile listed browsers equally across your screen. 4 open browsers would each take 25% of the screen.
1: 2: 3: 4: 5: 6: 7: 8: |
|
positionBrowser
Position current browser on the screen - position is in percentages: positionBrowser left top width height
1:
|
|
currentUrl
Gets the current url.
1:
|
|
title
Gets the title of the current page.
1:
|
|
reload
Reload the current page.
1:
|
|
navigate
Navigate forward or back.
1: 2: |
|
addFinder
Add a finder to the list of current finders to make your selectors cleaner.
1: 2: 3: 4: 5: 6: 7: |
|
Fast selectors
Skip looking through the list of finders for a specific selector, use a specific function.
1: 2: 3: 4: 5: 6: |
|
failsWith
Expect a failure with a specific message and pass test if it occurs
1:
|
|
from canopy
from canopy
module List
from Microsoft.FSharp.Collections
--------------------
type List<'T> =
| ( [] )
| ( :: ) of Head: 'T * Tail: 'T list
interface IReadOnlyList<'T>
interface IReadOnlyCollection<'T>
interface IEnumerable
interface IEnumerable<'T>
member GetSlice : startIndex:int option * endIndex:int option -> 'T list
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
...
static member CommandLine : string
static member CurrentDirectory : string with get, set
static member CurrentManagedThreadId : int
static member Exit : exitCode:int -> unit
static member ExitCode : int with get, set
static member ExpandEnvironmentVariables : name:string -> string
static member FailFast : message:string -> unit + 2 overloads
static member GetCommandLineArgs : unit -> string[]
static member GetEnvironmentVariable : variable:string -> string + 1 overload
static member GetEnvironmentVariables : unit -> IDictionary + 1 overload
...
nested type SpecialFolder
nested type SpecialFolderOption
Environment.GetFolderPath(folder: Environment.SpecialFolder, option: Environment.SpecialFolderOption) : string
| ApplicationData = 26
| CommonApplicationData = 35
| LocalApplicationData = 28
| Cookies = 33
| Desktop = 0
| Favorites = 6
| History = 34
| InternetCache = 32
| Programs = 2
| MyComputer = 17
...
type DateTime =
struct
new : ticks:int64 -> DateTime + 10 overloads
member Add : value:TimeSpan -> DateTime
member AddDays : value:float -> DateTime
member AddHours : value:float -> DateTime
member AddMilliseconds : value:float -> DateTime
member AddMinutes : value:float -> DateTime
member AddMonths : months:int -> DateTime
member AddSeconds : value:float -> DateTime
member AddTicks : value:int64 -> DateTime
member AddYears : value:int -> DateTime
...
end
--------------------
DateTime ()
(+0 other overloads)
DateTime(ticks: int64) : DateTime
(+0 other overloads)
DateTime(ticks: int64, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, calendar: Globalization.Calendar) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int) : DateTime
(+0 other overloads)
DateTime(year: int, month: int, day: int, hour: int, minute: int, second: int, millisecond: int, kind: DateTimeKind) : DateTime
(+0 other overloads)
DateTime.ToString(provider: IFormatProvider) : string
DateTime.ToString(format: string) : string
DateTime.ToString(format: string, provider: IFormatProvider) : string
static val Null : string
static val Cancel : string
static val Help : string
static val Backspace : string
static val Tab : string
static val Clear : string
static val Return : string
static val Enter : string
static val Shift : string
static val LeftShift : string
...
member Equals : obj:obj -> bool
member FindElement : context:ISearchContext -> IWebElement
member FindElements : context:ISearchContext -> ReadOnlyCollection<IWebElement>
member GetHashCode : unit -> int
member ToString : unit -> string
static member ClassName : classNameToFind:string -> By
static member CssSelector : cssSelectorToFind:string -> By
static member Id : idToFind:string -> By
static member LinkText : linkTextToFind:string -> By
static member Name : nameToFind:string -> By
...