Date post: | 06-Apr-2017 |
Category: |
Software |
Upload: | sun-technlogies |
View: | 26 times |
Download: | 0 times |
History of Selenium• Selenium was created by Jason Huggins in 2004.• Jason Huggins created a JavaScript program that would automatically control
the browser's actions. He named this program as the "JavaScriptTestRunner.“• Selenium 1, refers to Selenium RC.• Selenium RC and WebDriver are merged into a single framework to
form Selenium 2. • Google, who has been a long time user of Selenium, had a developer named
Simon Stewart who developed WebDriver. • This tool circumvented Selenium’s JavaScript sandbox to allow it to
communicate with the Browser and Operating System directly using native methods
• In 2008, Selenium and WebDriver merged technologies and intellectual intelligence to provide the best possible test automation framework
• The latest version of Selenium is 3.0 beta3.
© Sun Technologies Inc. 1
COMPONENTS OF SELENIUMSelenium is mainly built on 4 components.1.Selenium IDE.2.Selenium Remote Control (RC). 3.Selenium WebDriver.4.Selenium Grid.
© Sun Technologies Inc. 2
Selenium IDE• IDE stands for Integrated Development Environment.
• Which is used for Record and Play back the scripts.
• It is an Add on for Mozilla Firefox, which means we can download the Selenium IDE from Mozilla Firefox and we can Record and Run the scripts in Mozilla Firefox only.
• Selenium IDE is accountable for user actions.
• We can Run the Recorded scripts against other browsers by using Selenium RC.
© Sun Technologies Inc. 3
Architecture of Selenium IDE
© Sun Technologies Inc.4
SELENIUM RC• RC stands for Remote Control.
• It is a Server and launches the Browser.
• It acts as a API and Library of Selenium.
• We need to configure the Selenium RC with the supported language, then we can automate the application.
© Sun Technologies Inc. 5
Architecture of Selenium RC
© Sun Technologies Inc. 6
Selenium WebDriver• Selenium is a robust set of tools that supports rapid development of test
automation for web-based applications.
• Selenium is an open source tool (No cost Involved in it).
• Selenium supports the languages like HTML, Java, PHP, Perl, Python, Ruby and C#.
• It supports the browsers like IE, Mozilla Firefox, Safari, Google Chrome and Opera.
• It supports the operating systems like Windows, Linux and Mac.
© Sun Technologies Inc. 7
Architecture of Selenium Webdriver
© Sun Technologies Inc. 8
Softwares Needed• JDK
• Eclipse
• Selenium jar files Can be Downloaded from http://www.seleniumhq.org/download/
• Drivers for IE and Chrome
© Sun Technologies Inc. 9
Steps to install Selenium webdriver in Eclipse
Step 1: Install Java on your computer. • Download and install the Java Software Development Kit (JDK). You
download the JDK file from this location:http://www.oracle.com/technetwork/java/javase/downloads/index.html
© Sun Technologies Inc. 10
© Sun Technologies Inc. 11
Installation of java• Step 1 : Right Click on MyComputer and click on properties .• Step 2 : Click on Advanced tab
© Sun Technologies Inc. 12
• Step 3: Click on Environment Variables
• Step 4: Create a new class path for JAVA_HOME
© Sun Technologies Inc. 13
• Step 5: Enter the Variable name as JAVA_HOME and the value to your jdk bin path ie c:\Programfiles\Java\jdk-1.6\bin.• Step 6: NOTE Make sure u start with .; in the Value so that it doesn't
corrupt the other environment variables which is already set.• Step 7: Follow the Above step and edit the Path in System Variables
add the following ;c:\Programfiles\Java\jdk-1.6\bin in the value column.• Step 8: Your are done setting up your environment variables for your
Java , In order to test it go to command prompt and type• Java• who will get a list of help doc• In order make sure whether compiler is setup Type in cmd• Javac• will get a list related to javac
© Sun Technologies Inc. 14
Step 2: Install Eclipse IDE• Now download “Eclipse IDE for Java Developers”. You can download
eclipse from this location: http://www.eclipse.org/downloads/
© Sun Technologies Inc. 15
• Make sure to choose correct link for downloading eclipses which corresponds to your OS i.e. for Windows 32 Bit and 64 Bit versions.• You should be able to download a ZIP file named “eclipse-java-kepler-
SR1-win32-x86_64.zip”.
• Inside the ZIP file, there is an “eclipse” folder which contains all the application files. So we can extract the “eclipse” folder anywhere in your PC. Let say we want to extract it to C drive.
© Sun Technologies Inc. 16
Step 3 – Download the Selenium Java Client Driver• You can download the Selenium Java Client Driver from this location:
http://docs.seleniumhq.org/download/
© Sun Technologies Inc. 17
Add External Jars to Java build path• Right click on ‘Project‘ > Select Properties > Java build path. Then
navigate to Libraries tab and click Add External JARs.
© Sun Technologies Inc. 18
SELENIUM GRID• Selenium Grid is used for launching the multiple browsers with
supported operating system in parallel.
• We can run the scripts on different browsers in parallel.
• It allows you to easily run multiple tests in parallel, on multiple machines, in a heterogeneous environment.
© Sun Technologies Inc. 19
Architecture of Selenium Grid
© Sun Technologies Inc. 20
what are tools which help us to identify the elements?
Firebug and Firepath: These are two most popular tools to extract XPath of an element i.e location of an element on webpage.
FirePath: A very good tool for testing out XPath and CSS on the page. It will highlight all elements on the page that match the selector to your element location.
Xpath Checker: It is well known tool to find the XPath of an element.
IE Developer Tools: This is built into IE7, IE8 and IE9 that we can launch by pressing F12. It also has a number of features that Firebug has.
Google Chrome Developer Tools: This, like IE, is built into the browser and will also allow you to find the elements on the page and be able to work out its XPath.
© Sun Technologies Inc. 21
Types of Locators in SeleniumDefinition of Locator:-• Locator can be termed as an address that identifies a web element
uniquely within the webpage. • Locators are the HTML properties of a web element which tells the
Selenium about the web element it need to perform action on.• ID• ClassName• Name• Link Text• Partial Link Text• Tag Name• Xpath• CSS Selector
© Sun Technologies Inc. 22
Id LocatorLocating an Element By ID:• The most efficient way and preferred way to locate an element on a
web page is By ID.
• ID will be the unique on web page which can be easily identified.
• IDs are the safest and fastest locator option and should always be the first choice even when there are multiple choices, It is like an Employee Number or Account which will be unique.
• Example:-<input id=‘’’email’ class=“tech” type=“text”/>• Script looks like:-
• Webelement Ele = driver.findElement(By.id(“email”));
© Sun Technologies Inc. 23
Name LocatorLocating an Element By Name:• When there is no Id to use, the next worth seeing if the desired
element has a name attribute.
• But make sure there the name cannot be unique all the times.
• If there are multiple names, Selenium will always perform action on the first matching element
• Example:-<input name="register" class="required" type="text"/>• Script looks like:-
WebElement register= driver.findElement(By.name("register"));
© Sun Technologies Inc. 24
LinkText LocatorLocating an Element By LinkText:• Finding an element with link text is very simple. But make sure, there
is only one unique link on the web page.
• If there are multiple links with the same link text (such as repeated header and footer menu links), in such cases Selenium will perform action on the first matching element with link.
• Example:-<a href="http://www.seleniumhq.org">Downloads</a>• Script looks like:-
WebElement download = driver.findElement(By.linkText("Downloads"));
© Sun Technologies Inc. 25
PartailLinkText LocatorLocating an Element By Partial LinkText:
In the same way as LinkText, PartialLinkText also works in the same pattern.
• User can provide partial link text to locate the element.
• Example:-<a href="seleniumhq.org">Download selenium server</a>
• Script looks like:-• WebElement download = driver.findElement(By.PartialLinkText("Download"));
© Sun Technologies Inc. 26
TagName LocatorLocating an Element By TagName:• TagName can be used with Group elements like , Select and check-
boxes / dropdowns.
• Example:-Select select = new Select(driver.findElement(By.tagName("select")));select.selectByVisibleText("Nov");
© Sun Technologies Inc. 27
ClassName LocatorLocating an Element By Class Name:• There may be multiple elements with the same name, if we just use
findElementByClassName, make sure it is only one.
• If not the you need to extend using the classname and its sub elements.
• Example:-• WebElement classtest =driver.findElement(By.className(“sample”));
© Sun Technologies Inc. 28
CSS SelectorCSS Selector:• CSS mainly used to provide style rules for the web pages and we can
use for identifying one or more elements in the web page using css.
• We can you use Css Selectors to make sure scripts run with the same speed in IE browser.
• CSS selector is always the best possible way to locate complex elements in the page.
• Example:-• WebElement CheckElements = driver.findElements(By.cssSelector("input[id=email]"));
© Sun Technologies Inc. 29
Xpath LocatorXPath, the XML Path Language, is a query language for
selecting nodes from an XML document.
XPath is the unique identification of an element on a webpage.
It acts as an address to a webelement like text, textbox, radio button, buttons,Check box, Combo box, Tabs, Links, Images and any other webelement on webpage.
In real world we use address to uniquely identify a house or a colony(in group of houses),similarly we use XPath to uniquely identify an element on the webpage.
© Sun Technologies Inc. 30
Identification Techniques Using XPath
Use ID attribute if available :
• If the ID attribute is present for an object, use it in XPath even though the object can be identified with any other attributes. ID attribute should have the highest priority.
For example : It can be used as
//input[@id='username']
@ symbol indicate following is an attribute of the object.
© Sun Technologies Inc. 31
Identification Techniques Using XPath
Use combination of attributes in XPath :• If ID attribute is not available, any other attribute which uniquely identifies the
object can be used. Also combination of 2 or more attributes can be used to identify the object such as name, type, class, value etc. This will make the XPath more specific.
Examples://input[@id='username' and @type='text'] //input[@id='username' or @name='username'] //div[@title='View Patient Details - xyz, abc' and contains(@id,'patient')] //div[attribute::title='View Patient Details - xyz, abc' and
contains(attribute::id,'patient')]
Using combination of properties in XPath is useful in following cases :
• There are cases where there does not exist any single attribute which uniquely identify the object • Even if there is exist single attribute which uniquely identifies the object, we can
use combination of attributes to make Xpath more robust and hence there is less chances of failure in identification
© Sun Technologies Inc. 32
© Sun Technologies Inc. 33
Use Relative XPath instead of Absolute Xpath :Absolute Path refers that Xpath starts from root i.e. from ‘/’ to till the desired html element
is reached such as /html/body/div[3]/div[2]/div/form/input[@id='username']Relative path refers to the Xpath that starts from specific point to the desired element. It
starts with ‘//’. • It is always recommended to use Relative Xpath then Absolute xpath for following reasons.
1.Absolute Xpath will be very long compare to Relative xpath and hence difficult to manage 2.In case of Absolute Xpath , there are high chances that Xpath may break even if there are small changes introduced 3.Absolute Xpath has the disadvantage of typing the expression to a particular input structure • For example, we can have an absolute path as follows • /html/body/div[3]/div[2]/div/form/input[@id='username']• Using Relative path we can have • //input[@id='username']• //div[@id='ctl00_ContentPlaceHolder1_RadTabStrip_Tabs']//span[text()='Applications']
Identification Techniques Using XPath
Using .. (double dot symbol) to move to parent of the present node :
• Assume that you are in a specific node and want to move to parent of that node then it is advisable to use .. (double dot symbol) to navigate to parent node then using Parent::<node type> or ancestor::<node type>. • This will reduce the length of the XPath and identification of node faster during
execution. Consider the following example:the parent of the node td i.e. div can be reached using //li[text()='xyz, abc']/parent::ul/parent::div/parent::div[@id='patient_265']//li[text()='xyz, abc']/../../..[@id='patient_265']//li[text()='xyz, abc']/../../..[contains(@id,'patient')]//li[text()='xyz, abc']/ancestor::ul/ancestor::div/ancestor::div[@id='patient_265‘]//li[text()='xyz, abc']/ancestor::div[@title='View Patient Details - xyz, abc']Using Child://div[contains(@id,'patient')]/child::div/child::ul/li[text()='xyz, abc']//div[@title='View Patient Details - xyz, abc']/descendant::li[text()='xyz, abc']
© Sun Technologies Inc. 34
© Sun Technologies Inc. 35
Some of the XPath functions used are:
Position() –This function is for locating specific html tag such as //input[position()=5] to locate
5th element
Last() – This function is for locating last element node of the specific node type such as
//input[last()]. Further it can be specified as //input[last()-1] to identify an node before the last
node
Starts-with()- For Example : //div[starts-with(text(),’Approver’)]-Matches the element with string which begins with ‘Approver’
//div[starts-with(@id,’test’)]– Matches the element with attribute begins with string ‘test’
Contains () –For example : //span[contains(text(),’Approver’)]—Matches any element with text contains the string ‘Approver’
//span[contains(@id,’testing’)] – Matches any element with id attribute containing string ‘testing
© Sun Technologies Inc. 36
Use Preceding-sibling or Following-sibling wherever applicable : • If it is needed to navigate to immediate following or preceding node of
an element, then it is advisable to use following-sibling or preceding-sibling as applicable instead of just using following o preceding axes.
• This will enable faster/efficient identification of such elements
Examples:
//li[text()='Next BG Due:']/preceding-sibling::li[text()='xyz, abc']//li[text()='xyz, abc']/following-sibling::li[text()='Next BG Due:']
TestNG• TestNG is an open source automated testing framework, NG means
Next Generation.
• TestNG is similar to JUnit but it is much more powerful than JUnit but still it’s inspired by Junit.
• Cedric Beust who is the creator of TestNG.
• Using TestNG we can write more flexible and powerful tests with help of easy annotations, grouping, sequencing & parametrizing.
© Sun Technologies Inc. 37
Need of TestNG• TestNG can generate reports based on our Selenium test results.
• WebDriver has no native mechanism for generating reports.
• TestNG can generate the report in a readable format like the one shown below.
© Sun Technologies Inc. 38
Annotations in TestNGDef:-TestNG which guides it for what to do next or which method
should be executed next. TestNG has also facility to pass parameters with annotations.• @BeforeSuite: The annotated method will be run before all tests in
this suite have run.• @AfterSuite: The annotated method will be run after all tests in this
suite have run.• @BeforeTest: The annotated method will be run before any test
method belonging to the classes inside the tag is run.• @AfterTest: The annotated method will be run after all the test
methods belonging to the classes inside the tag have run.• @BeforeGroups: The list of groups that this configuration method
will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.
© Sun Technologies Inc. 39
• @AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.• @BeforeClass: The annotated method will be run before the first test
method in the current class is invoked.• @AfterClass: The annotated method will be run after all the test
methods in the current class have been run.• @BeforeMethod: The annotated method will be run before each test
method.• @AfterMethod: The annotated method will be run after each test
method.• @Test: The annotated method is a part of a test case.
© Sun Technologies Inc. 40
Example of without TestNG code
© Sun Technologies Inc. 41
Example of with TestNG code
© Sun Technologies Inc. 42
Use of testng.xml• Basically testng.xml is a configuration file.• We need to create testng.xml file to create and handle multiple test classes. • The xml file where you will configure your test run, set test dependency, include or exclude
any test, method, class or package and set priority etc.• testng.xml looks like:-• <?xml version="1.0" encoding="UTF-8"?>
• <suite configfailurepolicy="continue" name="Suite" parallel="none">
• <test name="Test" preserve-order="true">
• <classes>
• <class name="TestCases.TestCases"/>
• <methods>
• <include name="TC_001"/>
• <exclude name="2"/>
• <exclude name="3"/>
• </methods>
• </classes>
• </test>
• </suite>
© Sun Technologies Inc. 43
Advantages of TestNG• It gives the ability to produce HTML Reports of execution• Annotations made testers life easy• Test cases can be Grouped & Prioritized more easily• Parallel testing is possible• Generates Logs• Data Parameterization is possible
© Sun Technologies Inc. 44
First Script in Selenium WebDriver • We need to import following two packages:
org.openqa.selenium.* -> contains the WebDriver class needed to instantiate a new browser loaded with a specific driver.
org.openqa.selenium.firefox.FirefoxDriver -> contains the FirefoxDriver class needed to instantiate a Firefox-specific driver onto the browser instantiated by the WebDriver class.
• If your test needs more complicated actions such as accessing another class, taking browser screenshots, or manipulating external files, definitely you will need to import more packages.
© Sun Technologies Inc. 45
© Sun Technologies Inc. 46
• Instantiating objects and variables
Webdriver driver=new FirefoxDriver();A FirefoxDriver class with no parameters means that the default Firefox profile will
be launched by our Java program.
• Launching a Browser Session
driver.get(baseUrl);WebDriver's get() method is used to launch a new browser session and directs it to
the URL that you specify as its parameter.
• Get the Actual Page Title
actualTitle = driver.getTitle();The WebDriver class has the getTitle() method that is always used to obtain the
page title of the currently loaded page.
• Compare the Expected and Actual Valuesif (actualTitle.contentEquals(expectedTitle)) //compare the actual title of the page with the expected one{ System.out.println("Test Passed!");} else { System.out.println("Test Failed"); }
© Sun Technologies Inc. 47
• Terminating a Browser Session
driver.close(); The "close()" method is used to close the browser window.
• Terminating the Entire Program
• System.exit(0); If you use this command without closing all browser windows first, your whole Java
program will end while leaving the browser window open.
© Sun Technologies Inc. 48
Common Commands in Webdriver
• Instantiating Web ElementsWebElement
myElement=driver.findElement(By.id(“name_3_firstname”));
myElement.sendKeys(“Harry”); Instead of using the long "driver.findElement(By.locator())" syntax every time you
will access a particular element, we can instantiate a WebElement object for it. The
WebElement class is contained in the "org.openqa.selenium.*" package.
• Clicking on an Elementdriver.findElement(By.className(“wpcf7-form-control wpcf7-
submit”)).click(); The click() method is used to simulate the clicking of any element. It does not take any parameter/argument. The method automatically waits for a new page to load if applicable. The element to be clicked-on, must be visible (height and width must not
be equal to zero).
© Sun Technologies Inc. 49
Navigate commands in Webdriver
navigate().to() •It automatically opens a new browser window and fetches the page that you specify inside its parentheses.•It does exactly the same thing as the get() method.
navigate().refresh() •Needs no parameters.•It refreshes the current page.
navigate().back() •Needs no parameters•Takes you back by one page on the browser's history.
navigate().forward() •Needs no parameters•Takes you forward by one page on the browser's history.
© Sun Technologies Inc. 50
Switching Between Frames in Webdriver• To access GUI elements in a Frame, we should first direct WebDriver to
focus on the frame or pop-up window first, before we can access elements within them.• In order to do that, we must first instruct WebDriver to switch to the
"classFrame" frame using the "switchTo().frame()" method.• We will use the name attribute of the frame as the parameter for the
"frame()" part.• WebDriver allows pop-up windows like alerts to be displayed.• To access the elements within the alert (such as the message it
contains), we must use the "switchTo().alert()" method.• In the code below, we will use this method to access the alert box and
then retrieve its message using the "getText()"method, and then automatically close the alert box using the "switchTo().alert().accept()" method.
© Sun Technologies Inc. 51
Waits in Selenium Webdriver• There are two kinds of waits.• Implicit wait - used to set the default waiting time throughout the
program.• Explicit wait - used to set the waiting time for a particular instance only.
• Implicit WaitIt is simpler to code than Explicit Waits.It is usually declared in the instantiation part of the code.We will only need one additional package to import.To start using an implicit wait, we would have to import this package:
import java.util.concurrent.TimeUnit;On the instantiation part of your code, add this.
© Sun Technologies Inc. 52
• Explicit WaitExplicit waits are done using the WebDriverWait and ExpectedCondition
classes.For the following example, we shall wait up to 10 seconds for an element
whose id is “username " to become visible before proceeding to the next command.
Steps to write an Explicit wait in Selenium Webdriver:Step 1 -> Import these 2 packages.
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;
Step 2 -> Declare a WebDriverWait variable. In this example, we will use "myWaitVar" as the name of the variable.
© Sun Technologies Inc. 53
Methods used in conditional and looping operations
• isEnabled() is used when you want to verify whether a certain element is enabled or not before executing a command.
• isDisplayed() is used when you want to verify whether a certain element is displayed or not before executing a command.
© Sun Technologies Inc. 54
• isSelected() is used when you want to verify whether a certain check box, radio button, or option in a drop-down box is selected. It does not work on other elements.
© Sun Technologies Inc. 55
Keyboard Mouse Events
© Sun Technologies Inc. 56
Method DescriptionclickAndHold() Clicks (without releasing) at the current mouse location.
contextClick() Performs a context-click at the current mouse location.
doubleClick() Performs a double-click at the current mouse location.
dragAndDrop(source, target) Performs click-and-hold at the location of the source element, moves to the location of the target element,
then releases the mouse.Parameters:
source- element to emulate button down at.target- element to move to and release the mouse at.
dragAndDropBy(source, x-offset, y-offset) Performs click-and-hold at the location of the source element, moves by a given offset, then releases the
mouse.Parameters:
source- element to emulate button down at.xOffset- horizontal move offset.
yOffset- vertical move offset.
keyDown(modifier_key) Performs a modifier key press. Does not release the modifier key - subsequent interactions may assume
it's kept pressed.Parameters:
modifier_key - any of the modifier keys (Keys.ALT, Keys.SHIFT, or Keys.CONTROL)
keyUp(modifier _key) Performs a key release.Parameters:
modifier_key - any of the modifier keys (Keys.ALT, Keys.SHIFT, or Keys.CONTROL)
moveByOffset(x-offset, y-offset) Moves the mouse from its current position (or 0,0) by the given offset.
Parameters:x-offset- horizontal offset. A negative value means
moving the mouse left.y-offset- vertical offset. A negative value means
moving the mouse up.
© Sun Technologies Inc. 57
© Sun Technologies Inc. 58
moveToElement(toElement) Moves the mouse to the middle of the element.
Parameters:toElement- element to move to.
release() Releases the depressed left mouse button at the current mouse location
sendKeys(onElement, charsequence) Sends a series of keystrokes onto the element. Parameters:
onElement - element that will receive the keystrokes, usually a text field
charsequence - any string value representing the sequence of keystrokes to be sent
Action Class• Action Class in Selenium is used to handle keyboard and mouse events.• Following steps to be performed while using Action class.
Step 1: Import the Actions and Action classes.
• Step 2: Instantiate a new Actions object.
• Step 3: Instantiate an Action using the Actions object in step 2.
• Step 4: Use the perform() method when executing the Action object we designed in Step 3.
© Sun Technologies Inc. 59
Uploading Files• Remember following two things when uploading files in WebDriver• There is no need to simulate the clicking of the "Browse" button.
WebDriver automatically enters the file path onto the file-selection text box of the <input type="file"> element• When setting the file path in your Java IDE, use the proper escape
character for the back-slash.
© Sun Technologies Inc. 60
Frameworks• A framework defines a set of guidelines/best practices that enforces a
standard which makes it easy to use for the end users to work.
• There are 4 types of Framework. They are:
Keyword-Driven Framework.
Data-Driven Framework.
Hybrid Framework.
POM Framework.
© Sun Technologies Inc. 61
Keyword-Driven Framework• Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known
as Table-Driven testing or Action Word based testing.
• Keyword nothing but a code which represent some action, say “login”. in this framework, we map the
set of code which perform certain action with a keyword and then we use that keyword across the
framework.
• Keyword Driven Framework can be done and maintained with the help of Excel spread sheet:
• Test Step: It is a very small description of the Test Step or the description of the Action going to
perform onTest Object.
• Test Object: It is the name of the Web Page object/element, like Username & Password.
• Action: It is the name of the action, which is going to perform on any Object such
as click, open browser, input etc.
• Test Data: Data can be any value which is needed by the Object to perform any action, like
Username value for Username field.
© Sun Technologies Inc. 62
Data-Driven Framework• When some test needs to repeat for different data set , Data driven
framework gets used.
• In this framework, Parameters in the test case gets linked to database, excel,
csv, text files from there test case run for all defined parameter in the file.
• We will use the data excel‘src/test/resources/testData/default.xlsx’ file and
the file looks as below.
© Sun Technologies Inc. 63
Hybrid Framework• Combination of Keyword Driven Framework and Data Driven
Framework.
© Sun Technologies Inc. 64
POM Framework• Page Object model is writing all the functionalities / reusable
components of a page that we want to automate in a separate class. • The main advantage of Page Object Model is that if the UI changes for
any page, it don’t require us to change any tests, we just need to change only the code within the page objects (Only at one place).• Advantages:
There is clean separation between test code and page specific code such as locators (or their use if you’re using a UI map) and layout.
There is single repository for the services or operations offered by the page rather than having these services scattered through out the tests.
© Sun Technologies Inc. 65
Pros• Low Cost Tool• Browser Compatibility Testing• Choice of Language• Scripts can be saved and re-run at any time• Multiple Testing Frameworks• It is quite popular for quick-cycle development methodologies such as
Agile or Extreme Programming• Test Driven Development• Useful for Comprehensive Testing
© Sun Technologies Inc. 66
Cons• It doesn’t support windows based applications
• Despite its acceptance of other test script languages, it demands higher-level technical skills, such as programming, from QA team members.
• It requires third-party frameworks, language bindings and so on to be truly effective.
• Captcha image text can’t be automatable.(we need to request developers to give separate build to execute captcha image text verification)
© Sun Technologies Inc. 67
© Sun Technologies Inc. 68