Versions Compared

Key

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

Understanding Static and Dynamic Web Elements

Static Web Elements

A static web element is an element whose attribute values do not change. For example, 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: Assume 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 is 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:

...

Before we get in to creating objects, let’s cover some fundamentals.

Rules for Duplicate Objects

You can add an existing object under a different page, but QAS renames the object automatically. This is to avoid confusion when referring to the objects in your test cases.

...