Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Web Elements and Their Properties

Web elements are crucial for understanding Test Automation. They are the controls or components used in the application. For instance, 'Password' is an element referred to as 'Label'. The input box underneath 'Password' is another element known as 'TextBox' or 'WebInput'. Similarly, you'll see other elements like 'radio button' and 'button' (Log in).

...

Each type of web element has a distinct function and is classified into various categories based on this function.

The following are some commonly used web elements:

Web Elements Properties Generally, a property is a characteristic or attribute. For example, size is a property of your laptop. In the application being tested, a property is a mutable characteristic of a component that can be assigned different values.

...

Consider this example: 'Log in' is a web element of type button and it has the following properties with their respective values:

Name: Log in

Color: Green

Choosing the Right Properties

A web element may have multiple properties. Identifying a unique set of properties and their corresponding values is crucial for your test automation tool to recognize a specific web element uniquely each time during test automation.

...

In this case, the first input box has a value property = val1. You could use the value property here. However, this may not always be straightforward if the value properties change for some reason during subsequent rounds of testing.

Understanding Static and Dynamic Web Elements

Static Web Elements

A static web element is an element whose attribute values do not change. For instance, the attribute 'font-family' for a website's logo text typically remains constant. Identifying static web elements accurately is crucial for building reliable and maintainable test automation scripts. Misidentifying these elements can lead to ineffective or failed test executions.

Scenario: Imagine a login page where the username field's 'name' attribute is static, while its 'id' attribute is dynamically generated each time the page is loaded. Here, using the 'name' attribute would be the best practice for identifying this static web element since its value remains constant.

Dynamic Web Elements

A dynamic web element is one whose attribute values may change. For example, the value of the 'src' property of a carousel image on a homepage might vary. Identifying dynamic web elements correctly is critical for creating effective test automation scripts that can handle changes in the application.

...

Avoid attributes with unpredictable dynamism for identifying web elements, as this could lead to unreliable test scripts.

Setting Locator Priorities

The types of locators can be:

...