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

31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 

Último (20)

31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 

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