<commit_before><!doctype html>
<meta charset=utf-8>
<title>Guidelines and Recommendations</title>
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<link rel=stylesheet href=se.css>
<link rel=prev href=remote.html title="Remote WebDriver">
<link rel=next href=worst.html title="Worst Practices">
<script src=docs.js></script>

<h1>Guidelines and Recommendations</h1>

<p>Functional testing is difficult to get right for many reasons.
 As if application state, complexity, and dependencies don't make testing difficult enough,
 dealing with browsers – and especially cross-browser incompatibilities –
 makes writing good tests a challenge.

<p>Selenium provides tools to make functional user interaction easier,
 but doesn't help you write well-architected test suites.
 In this chapter we offer advice, guidelines, and recommendations.
 on how to approach functional web page automation.

<p>This chapter records software design patterns popular
 amongst many of the users of Selenium
 that have proven successful over the years.


<h2>Page object models</h2>

<p>Page Object is a Design Pattern which has become popular in test
automation for enhancing test maintenance and reducing code
duplication. A page object is an object-oriented class that serves as
an interface to a page of your AUT. The tests then use the methods of
this page object class whenever they need to interact with that page
of the UI. The benefit is that if the UI changes for the page, the
tests themselves don’t need to change, only the code within the page
object needs to change. Subsequently all changes to support that new
UI are located in one place.

<p>The Page Object Design Pattern provides the following advantage:
 There is clean separation between test code and page specific code<commit_msg>Added para on avoiding 'best practices'.<commit_after><!doctype html>
<meta charset=utf-8>
<title>Guidelines and Recommendations</title>
<link rel="icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<link rel="shortcut icon" href="favicon.ico" type="image/vnd.microsoft.icon">
<link rel=stylesheet href=se.css>
<link rel=prev href=remote.html title="Remote WebDriver">
<link rel=next href=worst.html title="Worst Practices">
<script src=docs.js></script>

<h1>Guidelines and Recommendations</h1>

<p>A note on "Best Practices": We've intentionally avoided the phrase "Best
Practices" in this documentation. No one approach works for all situations. 
We prefer the idea of "Guidelines and Recommendations." We encourage
you to read through these and thoughtfully decide what approaches 
will work for you in your particular environment.

<p>Functional testing is difficult to get right for many reasons.
 As if application state, complexity, and dependencies don't make testing difficult enough,
 dealing with browsers – and especially cross-browser incompatibilities –
 makes writing good tests a challenge.

<p>Selenium provides tools to make functional user interaction easier,
 but doesn't help you write well-architected test suites.
 In this chapter we offer advice, guidelines, and recommendations.
 on how to approach functional web page automation.

<p>This chapter records software design patterns popular
 amongst many of the users of Selenium
 that have proven successful over the years.


<h2>Page object models</h2>

<p>Page Object is a Design Pattern which has become popular in test
automation for enhancing test maintenance and reducing code
duplication. A page object is an object-oriented class that serves as
an interface to a page of your AUT. The tests then use the methods of
this page object class whenever they need to interact with that page
of the UI. The benefit is that if the UI changes for the page, the
tests themselves don’t need to change, only the code within the page
object needs to change. Subsequently all changes to support that new
UI are located in one place.

<p>The Page Object Design Pattern provides the following advantage:
 There is clean separation between test code and page specific code
{'fraction_non_alphanumeric': 0.06284882310118903, 'fraction_numerical': 0.0024265954865323952, 'mean_word_length': 5.245454545454545, 'pattern_counts': {'":': 1, '<': 44, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5346572', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1020, 'n_words': 556}