Endtest

Endtest

›Web Tests

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

IF Statements for Web Tests

Introduction

An If Statement is a conditional statement that, if proved true, performs a number of steps.

There are certain scenarios where we need to execute some steps only if a certain condition is met.

IF Statements can be nested in other IF Statements.

An IF Statement can cross the boundary of a test case and continue into the next test case.

If Statements

IF Statements can be added by using the Start If Statement action.

In order to close an IF Statement, we need to use the End If Statement action.

You can choose from the following types of IF Statements:

If Condition TypeDescription
Element Is PresentChecks if an element is present
Element Is Not PresentCheck if an element is not present.
Element Is VisibleChecks if an element is visible.
Element Is Not VisibleChecks if an element is not visible.
Element Is ClickableChecks if an element is clickable.
Element Is Not ClickableChecks if an element is not clickable.
Element Matches ValueChecks if the text from an element matches a certain value.
Element Does Not Match ValueChecks if the text from an element does not match a certain value.
Element Contains ValueChecks if the text from an element contains a certain value.
Element Does Not Contain ValueChecks if the text from an element does not contain a certain value.
Element Contains CSS ClassChecks if an element contains a certain CSS Class Name.
Element Does Not Contain CSS ClassChecks if an element does not contain a certain CSS Class Name.
Element Contains AttributeChecks if an element contains a certain attribute.
Element Does Not Contain AttributeChecks if an element does not contain a certain attribute.
Count Child ElementsChecks if the number of direct child elements matches a certain number.
Variable AssertionProvides multiple ways to check a variable.
Title Contains ValueChecks if the title of the web page contains a certain value.
Title Does Not Contain ValueChecks if the title of the web page does not contain a certain value.
URL Contains ValueChecks if the URL of the web page contains a certain value.
URL Does Not Contain ValueChecks if the URL of the web page does not contain a certain value.
Page Source Contains ValueChecks if the Page Source of the web page contains a certain value.
Page Source Does Not Contain ValueChecks if the Page Source of the web page does not contain a certain value.
Cookies Contain ValueChecks if the Cookies contain a certain value.
Cookies Do Not Contain ValueChecks if the Cookies do not contain a certain value.
Browser Logs Contain ValueChecks if the Browser Logs contain a certain value.
Browser Logs Do Not Contain ValueChecks if the Browser Logs do not contain a certain value.
Page Matches ScreenshotPerforms a visual comparison between the viewport and a baseline screenshot.
Full Page Matches ScreenshotPerforms a visual comparison between the entire page and a baseline screenshot.
Element Matches ScreenshotPerforms a visual comparison between an element and a baseline screenshot.

Else Statements

You can also use Else Statements, with the Start Else Statement and End Else Statement actions.

An Else Statement is an alternative statement that is executed if the result of a previous If Statement evaluates to false.

← Assertions for Web TestsWeb Applications with restricted access →
  • Introduction
  • If Statements
  • Else Statements
© Endtest Inc.