top of page
Basic commands

There are three kinds of commands: Actions, Checks, and Expectations.

Actions – functional action on the tested web application in the browser. For example, filling in fields, clicking a button and others;

Checks – performing checks on the tested page. For example, checking that a specific form field has a specified value, or checking the title of a window;

Expectations – organization of how, how much and what event Selenium will wait for (waiting for page load, ajax, etc.).

 

Checks in the test. Selenium uses 2 main checks:

assert* - "Statement" - this is a test, if that fails, the test fails.

verify* - "Check" - this is a check, if it fails, the test continues.

Checks of the "assert" type are used for critical checks, which if they do not pass, then there is no point in continuing the test at all. Verify checks are used for non-critical items.

  • verifyLocation / assertLocation – checks the current URL of the browser window (| verifyLocation | url_needed ||)

  • verifyTitle / assertTitle – checks the title of the window (|verifyTitle|title_needed||)

  • verifyValue / assertValue – checks that the form field has the specified value (|verifyValue|field|value_needed|)

  • verifyTextPresent / assertTextPresent – checks that the page text contains the specified text (|verifyTextPresent|text_needed||)

  • verifyElementPresent / assertElementPresent – checks that an element is present on the current page (|verifyElementPresent|element_needed||)
     

List of commands and their meanings

click - the most popular command, click on the element. Clicks in the center.

clickAndWait - click and wait. If a click causes another page to load, then the waitForPageToLoad command will be automatically executed.

waitForPageToLoad - wait for the page to load;

store* - Store item value

wait* - waiting for some event, such as the appearance of an element

open – open a page in a browser at a specific address.

click – click on the page element.

type – enter a value in the text box of the page. Usage example -selenium.Type("id_TextField_1", "test");

select – select a value from the drop-down list. Usage example – selenium.select (TimeEntryTaskList, "Activity1") .

selectWindow – switch focus to another window. Usage example – selenium.selectWindow("id_dashboard");

getTitle – returns the Title for the current page. Usage example – selenium.GetTitle();

getValue – returns the value of the page element. Usage example – selenium.GetValue("id_TextBox1");

goBack – return to the previous page. Usage example – selenium.GoBack();

close – close the current window. Usage example - selenium.Close().

verifyLocation / assertLocation – check the address of the current page.

getAlert - emulates pressing the OK button (the alert window does not appear)
verifyAlert(pattern) - checks that the text matches the pattern and clicks OK
assertAlert - checks that the text matches the pattern (if there is no test to fail) and clicks OK

  • Facebook Social Icon
  • Instagram
  • Vkontakte Social Icon
  • YouTube Social  Icon
  • mail_icon

© 2021 Galaxy QA Academy. All rights are protected.

bottom of page