Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.95 KB

File metadata and controls

64 lines (48 loc) · 1.95 KB
title id slug sidebar_label description number hide_table_of_contents level publish_date tags category
Use A Page Object
7-use-a-page-object
/7-use-a-page-object
Use A Page Object
One of the biggest challenges with Selenium tests is that they can be brittle and challenging to maintain over time. This is largely due to the fact that things in the app you're testing change, breaking your tests.
7
true
2
2013-07-09
page object
abstraction
tools

Using a Page Object

Intro

One of the biggest challenges with Selenium tests is that they can be brittle and challenging to maintain over time. This is largely due to the fact that things in the app you're testing change, breaking your tests.

But the reality of a software project is that change is a constant. So we need to account for this reality somehow in our test code in order to be successful.

A Solution

Enter Page Objects.

Rather than write your test code directly against your app, you can model the behavior of your application into simple objects -- and write your tests against them instead. That way when your app changes and your tests break, you only have to update your test code in one place to fix it.

And with this approach, we not only get the benefit of controlled chaos, we also get the benefit of reusable behavior.

import DisplayTips from '@site/src/components/displayTips';

<DisplayTips languages={[ {label: 'Ruby', value: 'ruby'}, {label: 'Selenide', value: 'selenide'}, ]}/>

About The Authors

import DefaultAvatar from "@site/src/components/defaultAvatar";

<DefaultAvatar name="Dave Haeffner" imgSrc={"/img/authors/dave-haeffner.jpeg#author-img"} description={"the original writer of Elemental Selenium"} url={"https://github.com/tourdedave"} />

<DefaultAvatar name="Andrei Solntsev" imgSrc={"https://github.com/asolntsev.png"} description={"Contributed the Selenide code for this tip."} url={"https://github.com/asolntsev"} />