SlideShare uma empresa Scribd logo
1 de 13
www.mindqonline.com


How Selenium Remote Control works






You launch a server on your test machine.
Your tests connect to that server via IP
.
The server launches a browser, with selenium CORE
embedded as javascript into the page.
Selenium CORE simulates user actions with javascript.

www.mindqonline.com
The Bad

The Good










Doesn’t steal your
mouse/keyboard.
Works with any browser that
uses javascript
Works for any OS that
supports java.
Very fast page interactions.
Large API
Supports a variety of
programming languages.
Can be run on remote
machines
www.mindqonline.com

Can’t see anything
outside the page object.
 Not all browsers support
all functionality.
 Some pages aren’t
automatable.
 Can’t see inside third
party apps
 XSS Limitations

A

different way of automating the browser.

 Create

a browser-specific driver to control the
browser directly.
 Have to do this for each browser!
 Object

oriented API
 Doesn’t need a real browser
 No javascript limitations
 No need for a server.
 Isn’t as delicate as selenium.

www.mindqonline.com
 Went

into Beta Dec 24th.
 Web Driver + Selenium
 The

two projects have merged (literally) into
Selenium 2.0
 Large browser support and no javascript
limitations.
 No server
 The old API’s are still available.
 New API’s are becoming available.

www.mindqonline.com
 You


IWebDriver






have 2 options:

This is just the WebDriver api
Doesn’t support a lot of browsers.
Will need to change all your tests.

WebDriverBackedSelenium




Uses the old Selenium 1 API
But uses WebDriver to run things if possible
Can use selenium 1 if the browser isn’t supported.

www.mindqonline.com



Object Oriented
Doesn’t break nearly as often





Handles pageloads automatically
Fewer problems automating

Somewhat more complicated API


selenium.type(“password”,”thisIsMyPassword”);



driver.findElement(By.id("password")).sendKeys(“thisIsMyPassword");







By.Id, By.Xpath, By.Name, By.ClassName, By.PartialLinkText

All the supported browsers work really well
Can extend the API to add custom functionality.
Works well with a Page Object design model.

www.mindqonline.com












Adds a layer of abstraction into your code.
Helps to organize your code once it grows large.
All automation is automatically reusable and shareable.
A way to separate tests from re-usable functions.
A way to store information about how the system works.
A way to specify what page functions start on, and what
page they end on.
A way to programmatically break your tests when
functionality changes.
Makes code maintenance easier.
There is even a PageFactory class available to
automatically create them.

www.mindqonline.com














Each page is defined as it’s own class.
Actions (including navigation) are represented as functions for a class.
Each function returns a new Page object, signifying what page the actions
stops on.
Your tests “know” what page you are on, and will only give you access to
functions available to that class.
Tests only talk to the page objects.
Page objects only talk to the driver.
Elements on the page are stored as variables for the page object.
Automatic page validations can be stored in the constructor for each
page object.
Tests become a string of well defined functions, not meaningless
gibberish.
Tests can be grouped by namespace.
Class Inheritance can be used to define functionality to a set of pages.
We can make functional logic transparent to the tests by returning
different inherited classes.

www.mindqonline.com
globalVars.logDescription = "log in";
globalVars.selenium.Open(globalVars.mobiUrl);
functions.type("userId", globalVars.studName + "1");
functions.type("password", globalVars.studPass + "1");
functions.clickAndWait("signInBtn");
selenium.click("//a[@id='discussions']/span");
selenium.click("//a[@id='thingsToKnow']/span");
globalVars.logDescription = "Checking elements on happenings:by date page";

selenium.waitForElementNotVisible("//div[@id='THSContainer']//span[@class='ajaxLoadingHeader']");
selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]");
selenium.click("//div[@id='THSContainer']//span[@class='replytext']");
selenium.click("backButton");
selenium.waitForElementVisible("//div[@id='TTHContainer']/ul[1]/li[1]");
selenium.click("//div[@id='TTHContainer']//span[@class='replytext']");
selenium.click("backButton");

globalVars.selenium.Select("byDateFilter", "label=Things Happening Soon");
selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]");
selenium.click("//div[@id='THSContainer']//span[@class='replytext']");
selenium.click("backButton");
globalVars.selenium.Select("byDateFilter", "label=Things That Happened");

www.mindqonline.com
[Test]

public void testByDateTab()
{
funtions.loginMobi();
selenium.click("//a[@id='discussions']/span");
selenium.click("//a[@id='thingsToKnow']/span");
functions.verifyThingsToKnow();
functions.verifyThingsHappeningSoon();
selenium.Select("byDateFilter", "label=Things That Happened");
functions.verifyThingsThatHappened();
}

www.mindqonline.com
[Test]
public void testByDateTab()
{
selenium.Open(Moby_Common.MobyLoginUrl);
LoginPage loginPage = new LoginPage(selenium);
HappeningsPage happeningsPage = loginPage.loginAs(Common.stud1Name, Common.stud1Password);
happeningsPage.waitToLoad();

Assert.That(!happeningsPage.isByTypePageLoaded());
Assert.That(happeningsPage.isByDatePageLoaded());
Assert.That(!happeningsPage.isByCoursePageLoaded());
happeningsPage.filterResults("byDateFilter","Things That Happened");
Assert.That(happeningsPage.isVisible("TTHContainer"));
happeningsPage.filterResults("byDateFilter", "Things Happening Soon");
Assert.That(happeningsPage.isVisible("THSContainer"));

happeningsPage.filterResults("byDateFilter", "All Types");
Assert.That(happeningsPage.isVisible("TTHContainer"));
Assert.That(happeningsPage.isVisible("THSContainer"));
}

www.mindqonline.com
public class HappeningsPage : WebPageBaseClass
{

public ContentItemPage goToItem(string type,
string name)
{

private string _loadingImage =
"//span[@class='ajaxLoadingHeader']";

click("//div[@id='" + type +
"']//span[text()="" + name + ""]");

private string _moreLink = "more";

return new ContentItemPage(selenium);
}

public HappeningsPage(ISelenium selenium)

public HappeningsPage clickMoreLink()

{

{

this.selenium = selenium;

click(_moreLink);

this.title = "Happenings";

return new HappeningsPage(selenium);

this.url = "index.html";

}

assertPageLoadedCorrectly();
}

public HappeningsPage filterResults(string id,
string name)

public HappeningsPage waitToLoad()

{

{

selectDropdown(id, name);

waitForElementNotVisible(_loadingImage );

return new HappeningsPage(selenium);

return new HappeningsPage(selenium);
}

}
}

www.mindqonline.com

Mais conteúdo relacionado

Mais procurados

Introduction to Selenium IDE
Introduction to Selenium IDEIntroduction to Selenium IDE
Introduction to Selenium IDEdrnikki
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriverAnuraj S.L
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsQUONTRASOLUTIONS
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectKnoldus Inc.
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautureszahid32
 
Automation Using Selenium Webdriver
Automation Using Selenium WebdriverAutomation Using Selenium Webdriver
Automation Using Selenium WebdriverEdureka!
 
Continuous Quality Assurance using Selenium WebDriver
Continuous Quality Assurance using Selenium WebDriverContinuous Quality Assurance using Selenium WebDriver
Continuous Quality Assurance using Selenium WebDriverAOE
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Edureka!
 
Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkAndrea Tino
 
Selenium webcrawler
Selenium webcrawlerSelenium webcrawler
Selenium webcrawlerRabia Khalid
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Mehdi Khalili
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingAgile Testing Alliance
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testingAdam Siton
 

Mais procurados (20)

Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Introduction to Selenium IDE
Introduction to Selenium IDEIntroduction to Selenium IDE
Introduction to Selenium IDE
 
Selenium drivers
Selenium driversSelenium drivers
Selenium drivers
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra Solutions
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala Project
 
Selenium introduction and some feautures
Selenium introduction and some feauturesSelenium introduction and some feautures
Selenium introduction and some feautures
 
Automation Using Selenium Webdriver
Automation Using Selenium WebdriverAutomation Using Selenium Webdriver
Automation Using Selenium Webdriver
 
Continuous Quality Assurance using Selenium WebDriver
Continuous Quality Assurance using Selenium WebDriverContinuous Quality Assurance using Selenium WebDriver
Continuous Quality Assurance using Selenium WebDriver
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by step
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
 
Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation framework
 
Selenium webcrawler
Selenium webcrawlerSelenium webcrawler
Selenium webcrawler
 
Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)Automated UI Testing Done Right (QMSDNUG)
Automated UI Testing Done Right (QMSDNUG)
 
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debuggingATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
ATAGTR2017 Upgrading a mobile tester's weapons with advanced debugging
 
Automating UI testing
Automating UI testingAutomating UI testing
Automating UI testing
 

Semelhante a Automating with selenium2

Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsQuontra Solutions
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplifiedVikas Singh
 
Moving from selenium to protractor for test automation
Moving from selenium to protractor for test automationMoving from selenium to protractor for test automation
Moving from selenium to protractor for test automationZoe Gilbert
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Developmentjoelabrahamsson
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presentedVijayan Reddy
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Atirek Gupta
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalorerajkamal560066
 
An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.BugRaptors
 
Appium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaAppium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaEdureka!
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applicationsRashwin
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17Jared Faris
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Lookrumsan
 

Semelhante a Automating with selenium2 (20)

Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 
Moving from selenium to protractor for test automation
Moving from selenium to protractor for test automationMoving from selenium to protractor for test automation
Moving from selenium to protractor for test automation
 
Node.js
Node.jsNode.js
Node.js
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Development
 
Qa process
Qa processQa process
Qa process
 
Qa process
Qa processQa process
Qa process
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Selenium Testing Training in Bangalore
Selenium Testing Training in BangaloreSelenium Testing Training in Bangalore
Selenium Testing Training in Bangalore
 
An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.An introduction to PhantomJS: A headless browser for automation test.
An introduction to PhantomJS: A headless browser for automation test.
 
Appium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | EdurekaAppium Interview Questions and Answers | Edureka
Appium Interview Questions and Answers | Edureka
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
 
Page object pattern
Page object patternPage object pattern
Page object pattern
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Look
 

Último

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Último (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Automating with selenium2

  • 2.  How Selenium Remote Control works     You launch a server on your test machine. Your tests connect to that server via IP . The server launches a browser, with selenium CORE embedded as javascript into the page. Selenium CORE simulates user actions with javascript. www.mindqonline.com
  • 3. The Bad The Good        Doesn’t steal your mouse/keyboard. Works with any browser that uses javascript Works for any OS that supports java. Very fast page interactions. Large API Supports a variety of programming languages. Can be run on remote machines www.mindqonline.com Can’t see anything outside the page object.  Not all browsers support all functionality.  Some pages aren’t automatable.  Can’t see inside third party apps  XSS Limitations 
  • 4. A different way of automating the browser.  Create a browser-specific driver to control the browser directly.  Have to do this for each browser!  Object oriented API  Doesn’t need a real browser  No javascript limitations  No need for a server.  Isn’t as delicate as selenium. www.mindqonline.com
  • 5.  Went into Beta Dec 24th.  Web Driver + Selenium  The two projects have merged (literally) into Selenium 2.0  Large browser support and no javascript limitations.  No server  The old API’s are still available.  New API’s are becoming available. www.mindqonline.com
  • 6.  You  IWebDriver     have 2 options: This is just the WebDriver api Doesn’t support a lot of browsers. Will need to change all your tests. WebDriverBackedSelenium    Uses the old Selenium 1 API But uses WebDriver to run things if possible Can use selenium 1 if the browser isn’t supported. www.mindqonline.com
  • 7.   Object Oriented Doesn’t break nearly as often    Handles pageloads automatically Fewer problems automating Somewhat more complicated API  selenium.type(“password”,”thisIsMyPassword”);  driver.findElement(By.id("password")).sendKeys(“thisIsMyPassword");     By.Id, By.Xpath, By.Name, By.ClassName, By.PartialLinkText All the supported browsers work really well Can extend the API to add custom functionality. Works well with a Page Object design model. www.mindqonline.com
  • 8.          Adds a layer of abstraction into your code. Helps to organize your code once it grows large. All automation is automatically reusable and shareable. A way to separate tests from re-usable functions. A way to store information about how the system works. A way to specify what page functions start on, and what page they end on. A way to programmatically break your tests when functionality changes. Makes code maintenance easier. There is even a PageFactory class available to automatically create them. www.mindqonline.com
  • 9.             Each page is defined as it’s own class. Actions (including navigation) are represented as functions for a class. Each function returns a new Page object, signifying what page the actions stops on. Your tests “know” what page you are on, and will only give you access to functions available to that class. Tests only talk to the page objects. Page objects only talk to the driver. Elements on the page are stored as variables for the page object. Automatic page validations can be stored in the constructor for each page object. Tests become a string of well defined functions, not meaningless gibberish. Tests can be grouped by namespace. Class Inheritance can be used to define functionality to a set of pages. We can make functional logic transparent to the tests by returning different inherited classes. www.mindqonline.com
  • 10. globalVars.logDescription = "log in"; globalVars.selenium.Open(globalVars.mobiUrl); functions.type("userId", globalVars.studName + "1"); functions.type("password", globalVars.studPass + "1"); functions.clickAndWait("signInBtn"); selenium.click("//a[@id='discussions']/span"); selenium.click("//a[@id='thingsToKnow']/span"); globalVars.logDescription = "Checking elements on happenings:by date page"; selenium.waitForElementNotVisible("//div[@id='THSContainer']//span[@class='ajaxLoadingHeader']"); selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); selenium.click("backButton"); selenium.waitForElementVisible("//div[@id='TTHContainer']/ul[1]/li[1]"); selenium.click("//div[@id='TTHContainer']//span[@class='replytext']"); selenium.click("backButton"); globalVars.selenium.Select("byDateFilter", "label=Things Happening Soon"); selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); selenium.click("backButton"); globalVars.selenium.Select("byDateFilter", "label=Things That Happened"); www.mindqonline.com
  • 12. [Test] public void testByDateTab() { selenium.Open(Moby_Common.MobyLoginUrl); LoginPage loginPage = new LoginPage(selenium); HappeningsPage happeningsPage = loginPage.loginAs(Common.stud1Name, Common.stud1Password); happeningsPage.waitToLoad(); Assert.That(!happeningsPage.isByTypePageLoaded()); Assert.That(happeningsPage.isByDatePageLoaded()); Assert.That(!happeningsPage.isByCoursePageLoaded()); happeningsPage.filterResults("byDateFilter","Things That Happened"); Assert.That(happeningsPage.isVisible("TTHContainer")); happeningsPage.filterResults("byDateFilter", "Things Happening Soon"); Assert.That(happeningsPage.isVisible("THSContainer")); happeningsPage.filterResults("byDateFilter", "All Types"); Assert.That(happeningsPage.isVisible("TTHContainer")); Assert.That(happeningsPage.isVisible("THSContainer")); } www.mindqonline.com
  • 13. public class HappeningsPage : WebPageBaseClass { public ContentItemPage goToItem(string type, string name) { private string _loadingImage = "//span[@class='ajaxLoadingHeader']"; click("//div[@id='" + type + "']//span[text()="" + name + ""]"); private string _moreLink = "more"; return new ContentItemPage(selenium); } public HappeningsPage(ISelenium selenium) public HappeningsPage clickMoreLink() { { this.selenium = selenium; click(_moreLink); this.title = "Happenings"; return new HappeningsPage(selenium); this.url = "index.html"; } assertPageLoadedCorrectly(); } public HappeningsPage filterResults(string id, string name) public HappeningsPage waitToLoad() { { selectDropdown(id, name); waitForElementNotVisible(_loadingImage ); return new HappeningsPage(selenium); return new HappeningsPage(selenium); } } } www.mindqonline.com