Entering Data

Entering Data

You need to specify the string which you want to enter into the field as well as the field where it should be entered:
enter "olive oil" into "search"
You can use relative locations to help locate elements that are harder to pinpoint. However, this should be reserved for when there are several instances of the desired element.
enter "olive oil" into "search" to the left of "Accounts and lists"
If the previous step has already put the cursor onto the input field, you can use type command without specifying the input field name:
click "search"
type "olive oil"
Also use ‘type’/’enter’ to simulate pressing a key or a combination of keys on the keyboard.
type enter 
type ctrl a
For multi-line text inputs, all you need to do is specify lines, as well as the end of the text:
enter text starting from next line and ending with [END]
Hello Max,
Let's discuss the opportunity
[END] into "Notes"

Checking checkboxes

There will typically be multiple checkboxes on the page. In this case, you need to provide additional context – so that testRigor knows which checkbox you want to use. You can use the browser’s inspect feature to locate the label of the element, or its id, or use a relative location. Indexes work too.
click checkbox to the left of "Add to cart"
click 2nd checkbox "id"
Sometimes, developers use binary inputs as checkboxes. Clicking with JavaScript doesn’t always enable the checkbox in these instances, so we either click using the mouse or we use the “enter” command (0 = off, 1= on):
enter "1" into "checkbox_3"
enter "on" into checkbox to the left of "Add to cart"

Dealing with dropdowns

Use the “select” command to select a value from a dropdown. Specify the value, as well as the name of the dropdown:
select "Books" from "All"
You can also select by the number the option appears in the dropdown:
select 1st option from "MySelect"
select second option from "MySelect"
select option 10 from "MySelect"
Read full documentation about entering data here.

Native browser dropdowns vs. Custom dropdowns

There are several types of dropdowns, but they are all placed in one of two categories: native browser dropdowns and custom dropdowns. The relevance of this is that native browser dropdowns  require direct interaction with the browser, and custom dropdowns require direct interaction with the UI.

Native browser dropdowns can be identified by their html tag <select>. For best results, we use the “select” command as specified above.

Custom dropdowns, however, are tagged as either <div> or <input>, thus allowing them to be interacted with more like a human would with clicks.

The following are the two most common types of custom dropdowns:

Standard dropdown:

The best way to interact with this type of custom dropdown by clicking on the dropdown to expand it, and then clicking on the value.
click "Select Year" on the right of "Model"
click "2017"

Auto-suggest dropdown: A users clicks a dropdown and types a partial or full term after which the dropdown displays options limited to those that match the string typed and the user clicks on the desired option.

There are two ways to interact with this type of custom dropdown:

  1. Enter and click (works better when the element is tagged as an <input>):
    enter "react" into "React Dropdown Select"
    click "ReactDropdownOption1"
  2. Click, type, and click (works better with <div> tags):
    click "React Dropdown Select"
    type "reactdrop"
    click "ReactDropdownOption1"

*Note that a partial string is preferred for the option typed into the field, and the full string is preferred for clicking. This is to avoid having two of the same exact strings on the page when the click command is used.

testRigor has 3 options to identify dropdowns, this setting can be changed under Settings > Advanced > Dropdown detection strategy. Typically you might want to change it only if detecting dropdowns takes too long, and you want the test to run faster.

  • Use Machine Learning to detect dropdowns – Default option
  • Optimistic, attend to guess dropdowns – The least accurate
  • Pessimistic, only rely on known dropdowns – The most accurate and also fastest, but will identify fewer dropdowns than Machine Learning

Dealing with tables

You can refer to elements of the table by specifying row and column. And to specify a row there is a powerful SQL-like language available. For example, you can say things like:
click "Delete" inside of table at row containing "my unique id" and column "Actions"

Here we didn’t specify the column where the “my unique id” should reside, but rather indicated that it could be in any column at that row.

You can also construct SQL-like expressions containing one or multiple columns with different validations. For example:
check that table with "Country" equal to "United States" and "City" equal to "Saint Petersburg" and "State" equal to "Florida" at column "Status" contains "Flourishing"
Here we used 3 different conditions to identify the row connected with the boolean operator AND. The following boolean operators are supported:
  • AND
  • OR
  • NOT
  • Brackets ()
and you can also use brackets. The condition calculation will follow the standard boolean logic. The condition above could also be expressed like so:
check that table with not("Country" not equal to "United States" or "City" not equal to "Saint Petersburg" or "State" not equal to "Florida") at column "Status" contains "Flourishing"

You can learn more about how boolean operators work here.

Test your knowledge

click checkbox “my_checkbox” 5 times
click 5th “my_checkbox”
type “5” for “my_checkbox”
select 5th checkbox “my_checkbox”
Use the “select” command
Use the “click, type, click” sequence
Use the “enter, click” sequence
Use the “enter, type, click” sequence
[wpcode id=”1112380″ answers=”2;2″ page=”Entering Data” numoffields=”2″]