Assert that an text or element is visible.

I.see can also be used to hint to the test engine parts of the page to focus on when there are similar elements to pick for subsequent commands. See "Hinting when there are similar elements" below.

Ignores casing and white-spaces. This behavior is not configurable at the moment.


Parameter Type Remarks
target string Text or element to find

Returns: true if element is visible.

# See text

I.see("Welcome back, Bruce");

Assets that the text "Welcom back, Bruce" is visible.

# See element with CSS / XPATH


Assets that the element with the CSS class rainbow is visible.

Hinting when there are similar elements

Sometimes, you'd have similar elements on the page that you need to target, such as the Name and Email field for Ticket 1 and Ticket 2 in the example above.

In these scenarios, the test engine uses elements targeted in previous steps as context to resolve the ambiguity, and elements that are closer to previous elements targeted would be preferred. You can make use of this mechanism to tell the test engine where the next commands should target using I.see in the scenarios.

I.see("Ticket 1") 
I.fill("Name", "Bruce") // the "Name" field closer to "Ticket 1" will be preferrred
I.fill("Email", "bruce@waynecorp.com")

I.see("Ticket 2")
I.fill("Name", "Alfred") // the "Name" field closer to "Ticket 2" will be preferrred
I.fill("Email", "alfred@waynecorp.com")

Stronger hints with .signpost


Because the test engine evaluates recent steps and not just the last step as context to resolve ambiguity, it might not always target the element you intended, especially when some of the recents steps are not relevant to the current command. You can use I.see.signpost indicate to the test engine to limit the context to the signposted element.

I.see("Ticket 1") 
I.fill("Name", "Bruce") 
I.fill("Email", "bruce@waynecorp.com")

I.see.signpost("Ticket 2") 
I.fill("Name", "Alfred")
I.fill("Email", "alfred@waynecorp.com")

In this example, we set "Ticket 2" as a signpost, and for the subsequent commands to fill "Name" and "Email", the test engine only compare matched input fields with reference to "Ticket 2".

Using I.see with conditionals

I.see returns true when the text or element is visible, and this can be used to conditionally control the flow of your test.

if(I.see("Discard previous draft")){
I.fill("Invoice Reference", "INV-03922");

In this example, if the word "Discard previous draft" is visible, the test will run I.click("Yes") before proceeding with the rest of the test.