0% found this document useful (0 votes)
14 views

Selenium Notes

Selenium notes

Uploaded by

divya chandak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Selenium Notes

Selenium notes

Uploaded by

divya chandak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

InternetExplorerDriver driver = new InternetExplorerDriver(); or

RemoteWebDriver driver= new ChromeDriver();


We don’t just run our scripts only on single browser. We use multiple browsers
for Cross Browser Compatibility. We need the flexibility to use other browsers
like ChromeDriver() to run on Chrome Browser and InternetExplorerDriver() to
run on IE Browser and so on.
So, once you initiate a Firefox browser using FirefoxDriver driver = new
FirefoxDriver(); same object cannot be used to initiate Chrome Browser (you
have to rename it)
Remote Webdriver is a class and directly referencing it would limit the ability
to switch to other browser.
WebDriver driver = new FirefoxDriver();
We can create Object of a class FirefoxDriver by taking reference of an
interface (WebDriver). In this case, we can call implemented methods of
WebDriver interface.
If you define driver as a WebDriver, switching will be very easy. If we use this
statement in our script then the WebDriver driver can implement any browser.
Every browser driver class implements WebDriver interface and we can get all
the methods. It helps you when you do testing on multiple browsers.

Here, WebDriver is an interface, driver is a reference variable, FirefoxDriver() is


a Constructor, new is a keyword, and new FirefoxDriver() is an Object.

Page object model:

Page Object Model is a Design Pattern which has become popular in Selenium
Test Automation. It is widely used design pattern in Selenium for enhancing
test maintenance and reducing code duplication. Page object model (POM)
can be used in any kind of framework such as modular, data-driven, keyword
driven, hybrid framework etc.

A page object is an object-oriented class that serves as an interface to a page


of your Application Under Test(AUT). The tests then use the methods of this
page object class whenever they need to interact with the User Interface (UI)
of that page. 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.

What is the difference between Page Object Model


(POM) and Page Factory:
Page Object is a class that represents a web page and hold the functionality
and members.
Page Factory is a way to initialize the web elements you want to interact with
within the page object when you create an instance of it.

Advantages of Page Object Model Framework:


 Code reusability – We could achieve code reusability by writing the
code once and use it in different tests.
 Code maintainability – There is a clean separation between test code
and page specific code such as locators and layout which becomes very
easy to maintain code. Code changes only on Page Object Classes when
a UI change occurs. It enhances test maintenance and reduces code
duplication.
 Object Repository – Each page will be defined as a java class. All the
fields in the page will be defined in an interface as members. The class
will then implement the interface.
 Readability – Improves readability due to clean separation between test
code and page specific code

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy