SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
SELENIUM
Test Automation and much more!
TESTAUTOMATIONTODAY
Web UI Test Automation
Selenium, Watir, PhantomJS, CasperJS, Sahi, QTP, SauceLabs
Native Desktop UI Automation
AutoIt, Sikuli, QTP, TestComplete
Mobile App Test Automation
MonkeyTalk, Calabash, Selendroid, Appium, EggPlant
Performance Test Automation
JMeter, Load Runner, NeoLoad, HttPerf
SAYHELLOTOSELENIUM!
Who am I?
A set of open source tools to interact with browser application in an automated way.
What are my tools?
Selenium IDE, Selenium 1 (RC), Selenium 2 (WebDriver)
Who are my creators?
Selenium 1 - Jason Huggins, Selenium 2 - Simon Stewart
SELENIUMROCKS!SAYHOW?
Limitless possibilities of using Selenium
Possible interesting uses:
Test Automation, ofcourse!
Web data scraping
Performing CRUDs on a webpage repetitively (Bulk data
creation from the UI)
As a content downloader!
Automated reply to Facebook posts?
HOWWASSELENIUMEARLIER??
Called as Selenium RC (Remote Control), had a server which
launches, stops and interacts with the browser.
Selenium Commands from code -> RC Server -> Javascript
commands to browser
Client libraries used HTTP GET / POST to interact with the
selenium server
Selenium Server used Selenium Core which was a set of JS
programs that were injected into the browser for executing the
commands sent.
Client libraries were in Python, Ruby, Java, .NET, PHP, Perl
SELENIUMRCARCHITECTURE
WHYEVERYBODYMOVINGTO
SELENIUM2???
Problems with Selenium RC
Explicitly start the server
No good organized API
Used Javascript Injection
Slower execution
No new enhancements. Deprecation!!
Same origin policy problem
WEBDRIVER
Binds natively to the browser. No Javascript injection in browser's JS Sandbox
Better object oriented API
Bindings for Java, Python, C#, Ruby, Perl, Php, JS
Significantly fewer calls than Selenium RC
Variants: ChromeDriver, FireFoxDriver, InternetExplorerDriver, OperaDriver, AndroidDriver,
IPhoneDriver, HtmlUnitDriver
Overcomes same origin policy problem
Self-contained library. No server to start explicitly.
WEBDRIVERARCHITECTURE
LEARNINGTHESEWILLMAKEUSING
SELENIUMEASIER!
HTML, CSS and Javascript from
andCodeacademy HTMLDog
THEDOM!!
Cross-platform, language-independent convention for representing and interacting with
objects in HTML, XHTML and XML documents.
HTML is structured according to DOM and DOM of the webpage is accessed by Selenium
THEC#SELENIUMNAMESPACE
DRIVINGTHEDRIVER
Interface - IWebDriver; Implements - ISearchContext, IDisposable
Functionality - Controls the browser, Finds elements, Helps in debugging
Usage - Creating instance of a flavor of webdriver class that implements this interface
Commonly used methods - FindElement, FindElements, Manage, Navigate, Quit, Close
Commonly used properties - Title, URL
WEBELEMENT
Interface - IWebElement; Implements - ISearchContext
Functionality - Provides methods to identify and interact with DOM
elements on web page. Instance of it represents a HTML element.
Usage: Created using FindElement / FindElements method on driver
instance or another webelement object.
Commonly used methods: Click, SendKeys, Clear, Submit,
GetAttribute, GetCssValue
Commonly used properties: Displayed, Text, Enabled, Selected,
TagName
ELEMENTLOCATING
Use By class to locate elements
By class provides following static member methods:
CssSelector
ClassName
Id
XPath
TagName
LinkText
PartialLinkText
Name
Subclass the By class to build your own locating mechanism. Eg: ByIdOrName
LOCATINGBYID
Id is the King!
W3C standards state Ids should be unique.
Independent from the type of element.
Developers usually give ids to elements which contain dynamic
elements. Benefit!
If your developer doesn't add ids, convince him to do so!
LOCATINGBYCSS/XPATHSELECTORS
css prefered over xpath.
xpath engines different for different browsers.
xpath tend to become complex and difficult to read.
xpath useful when you want to fetch parent element or
find element by text.
USEFULLINKSFORXPATHANDCSS
SELECTORS
Xpath to Css Cheat Sheet
Elemental Selenium Blog on performance benchmarks for
CSS and XPATH selectors
A stackoverflow post
"A good way to start a CSS or Xpath locator is to start with an
element that you know is not likely to change much and use it
as an ‘anchor’ in your locator. It may have an ID or stable location
but not be the element you need to locate but is a reliable position to
search from. Your anchoring element can be above or below the
current element in the HTML tree, but most often it’s above."
How do I find the <li> ??
INDEXANDDESCENDANTLOCATORS
Index locators
nth-child(), nth-of-type()
Use when finding element in a list, by index
Nth-child example: p:nth-child(2)
Nth-of-type: p:nth-of-type(2)
Descendant Locators
Use when finding direct child elements of parent
CSS example: div > div > ul > li > span
Xpath example: //div/div/ul/li/span
COMPONENTOBJECTPATTERN
Create a single class for interacting with a widget/complex
control present frequently on different pages of the website
YOUNEEDTOWAITFORMR.AJAX!
AJAX (Asynchronous Javascript & XML)
Dynamic content rendered and updated with the help of
AJAX and Javascript
This calls for the need to test dynamic UI which has time
uncertainty
WebDriver handles this using Implict and Explict waiting mechanism
Link: WebDriver Wait Commands
COMMONEXCEPTIONS
ElementNotVisibleException : Use Javascript to make element visible
IllegalLocatorException: when By.className() is used with a compound class name.
NoSuchElementException: Use waits OR verify your locator
StaleElementReferenceException: Happens if a DOM operation happening on the page is
temporarily causing the element to be inaccessible.
public boolean retryFindClick(By by) {
boolean result = false;
int attempts = 0;
while(attempts < 2) {
try {
driver.findElement(by).click();
result = true;
break;
} catch(StaleElementException e) {
}
attempts++;
}
return result;
IJAVASCRIPTEXECUTOR
Used to execute javascript on webpage.
Can be used for finding elements
Performing actions like click or selecting control
Syntax:
IJavaScriptExecutor jsExec = (IJavaScriptExecutor)_driver;
_searchTextField = (IWebElement)jsExec.ExecuteScript("return document.getElementBy
_searchTextField.SendKeys(searchString);

Weitere ähnliche Inhalte

Was ist angesagt?

Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverPankaj Biswas
 
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.
 
Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsSauce Labs
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriverAnuraj S.L
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using JavaF K
 
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!
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.pptAna Sarbescu
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics TutorialClever Moe
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing AutomationAgileEngine
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor🌱 Dale Spoonemore
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyOren Farhi
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object patternMichael Palotas
 

Was ist angesagt? (20)

Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
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
 
Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason Huggins
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
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...
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics Tutorial
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
UI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected JourneyUI Testing Best Practices - An Expected Journey
UI Testing Best Practices - An Expected Journey
 
Selenium - The page object pattern
Selenium - The page object patternSelenium - The page object pattern
Selenium - The page object pattern
 

Andere mochten auch

Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Selenium Tips & Tricks
Selenium Tips & TricksSelenium Tips & Tricks
Selenium Tips & TricksDave Haeffner
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Edureka!
 

Andere mochten auch (7)

Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
 
Test ng for testers
Test ng for testersTest ng for testers
Test ng for testers
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
testng
testngtestng
testng
 
Selenium Tips & Tricks
Selenium Tips & TricksSelenium Tips & Tricks
Selenium Tips & Tricks
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
 

Ähnlich wie Selenium Overview

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
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfAnuragMourya8
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersAjit Jadhav
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hellNikita Simonovets
 
Introduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationIntroduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationAhmed Mubbashir Khan
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsJai Singh
 
How to use selenium locators effectively for web automation.pdf
How to use selenium locators effectively for web automation.pdfHow to use selenium locators effectively for web automation.pdf
How to use selenium locators effectively for web automation.pdfpcloudy2
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshersNaga Mani
 
Automated_Testing_Selenium
Automated_Testing_SeleniumAutomated_Testing_Selenium
Automated_Testing_SeleniumJagdish Kaushal
 
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
 
Automatedtestingwithselenium shubham jain
Automatedtestingwithselenium shubham jainAutomatedtestingwithselenium shubham jain
Automatedtestingwithselenium shubham jainPrashant Gurav
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium locators: ID, Name,  xpath, CSS Selector advance methodsSelenium locators: ID, Name,  xpath, CSS Selector advance methods
Selenium locators: ID, Name, xpath, CSS Selector advance methodsPankaj Dubey
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfTop 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfAnanthReddy38
 

Ähnlich wie Selenium Overview (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
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Introduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationIntroduction to Selenium and Test Automation
Introduction to Selenium and Test Automation
 
Selenium Webdriver Interview Questions
Selenium Webdriver Interview QuestionsSelenium Webdriver Interview Questions
Selenium Webdriver Interview Questions
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
How to use selenium locators effectively for web automation.pdf
How to use selenium locators effectively for web automation.pdfHow to use selenium locators effectively for web automation.pdf
How to use selenium locators effectively for web automation.pdf
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium interview-questions-freshers
Selenium interview-questions-freshersSelenium interview-questions-freshers
Selenium interview-questions-freshers
 
Automated_Testing_Selenium
Automated_Testing_SeleniumAutomated_Testing_Selenium
Automated_Testing_Selenium
 
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...
 
Automatedtestingwithselenium shubham jain
Automatedtestingwithselenium shubham jainAutomatedtestingwithselenium shubham jain
Automatedtestingwithselenium shubham jain
 
Selenium WebDriver training
Selenium WebDriver trainingSelenium WebDriver training
Selenium WebDriver training
 
Selenium locators: ID, Name, xpath, CSS Selector advance methods
Selenium locators: ID, Name,  xpath, CSS Selector advance methodsSelenium locators: ID, Name,  xpath, CSS Selector advance methods
Selenium locators: ID, Name, xpath, CSS Selector advance methods
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfTop 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
 

Kürzlich hochgeladen

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Selenium Overview

  • 2. TESTAUTOMATIONTODAY Web UI Test Automation Selenium, Watir, PhantomJS, CasperJS, Sahi, QTP, SauceLabs Native Desktop UI Automation AutoIt, Sikuli, QTP, TestComplete Mobile App Test Automation MonkeyTalk, Calabash, Selendroid, Appium, EggPlant Performance Test Automation JMeter, Load Runner, NeoLoad, HttPerf
  • 3. SAYHELLOTOSELENIUM! Who am I? A set of open source tools to interact with browser application in an automated way. What are my tools? Selenium IDE, Selenium 1 (RC), Selenium 2 (WebDriver) Who are my creators? Selenium 1 - Jason Huggins, Selenium 2 - Simon Stewart
  • 4. SELENIUMROCKS!SAYHOW? Limitless possibilities of using Selenium Possible interesting uses: Test Automation, ofcourse! Web data scraping Performing CRUDs on a webpage repetitively (Bulk data creation from the UI) As a content downloader! Automated reply to Facebook posts?
  • 5. HOWWASSELENIUMEARLIER?? Called as Selenium RC (Remote Control), had a server which launches, stops and interacts with the browser. Selenium Commands from code -> RC Server -> Javascript commands to browser Client libraries used HTTP GET / POST to interact with the selenium server Selenium Server used Selenium Core which was a set of JS programs that were injected into the browser for executing the commands sent. Client libraries were in Python, Ruby, Java, .NET, PHP, Perl
  • 7. WHYEVERYBODYMOVINGTO SELENIUM2??? Problems with Selenium RC Explicitly start the server No good organized API Used Javascript Injection Slower execution No new enhancements. Deprecation!! Same origin policy problem
  • 8. WEBDRIVER Binds natively to the browser. No Javascript injection in browser's JS Sandbox Better object oriented API Bindings for Java, Python, C#, Ruby, Perl, Php, JS Significantly fewer calls than Selenium RC Variants: ChromeDriver, FireFoxDriver, InternetExplorerDriver, OperaDriver, AndroidDriver, IPhoneDriver, HtmlUnitDriver Overcomes same origin policy problem Self-contained library. No server to start explicitly.
  • 10. LEARNINGTHESEWILLMAKEUSING SELENIUMEASIER! HTML, CSS and Javascript from andCodeacademy HTMLDog
  • 11. THEDOM!! Cross-platform, language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents. HTML is structured according to DOM and DOM of the webpage is accessed by Selenium
  • 13. DRIVINGTHEDRIVER Interface - IWebDriver; Implements - ISearchContext, IDisposable Functionality - Controls the browser, Finds elements, Helps in debugging Usage - Creating instance of a flavor of webdriver class that implements this interface Commonly used methods - FindElement, FindElements, Manage, Navigate, Quit, Close Commonly used properties - Title, URL
  • 14. WEBELEMENT Interface - IWebElement; Implements - ISearchContext Functionality - Provides methods to identify and interact with DOM elements on web page. Instance of it represents a HTML element. Usage: Created using FindElement / FindElements method on driver instance or another webelement object. Commonly used methods: Click, SendKeys, Clear, Submit, GetAttribute, GetCssValue Commonly used properties: Displayed, Text, Enabled, Selected, TagName
  • 15.
  • 16. ELEMENTLOCATING Use By class to locate elements By class provides following static member methods: CssSelector ClassName Id XPath TagName LinkText PartialLinkText Name Subclass the By class to build your own locating mechanism. Eg: ByIdOrName
  • 17. LOCATINGBYID Id is the King! W3C standards state Ids should be unique. Independent from the type of element. Developers usually give ids to elements which contain dynamic elements. Benefit! If your developer doesn't add ids, convince him to do so!
  • 18. LOCATINGBYCSS/XPATHSELECTORS css prefered over xpath. xpath engines different for different browsers. xpath tend to become complex and difficult to read. xpath useful when you want to fetch parent element or find element by text.
  • 19. USEFULLINKSFORXPATHANDCSS SELECTORS Xpath to Css Cheat Sheet Elemental Selenium Blog on performance benchmarks for CSS and XPATH selectors A stackoverflow post
  • 20. "A good way to start a CSS or Xpath locator is to start with an element that you know is not likely to change much and use it as an ‘anchor’ in your locator. It may have an ID or stable location but not be the element you need to locate but is a reliable position to search from. Your anchoring element can be above or below the current element in the HTML tree, but most often it’s above." How do I find the <li> ??
  • 21. INDEXANDDESCENDANTLOCATORS Index locators nth-child(), nth-of-type() Use when finding element in a list, by index Nth-child example: p:nth-child(2) Nth-of-type: p:nth-of-type(2) Descendant Locators Use when finding direct child elements of parent CSS example: div > div > ul > li > span Xpath example: //div/div/ul/li/span
  • 22. COMPONENTOBJECTPATTERN Create a single class for interacting with a widget/complex control present frequently on different pages of the website
  • 23. YOUNEEDTOWAITFORMR.AJAX! AJAX (Asynchronous Javascript & XML) Dynamic content rendered and updated with the help of AJAX and Javascript This calls for the need to test dynamic UI which has time uncertainty WebDriver handles this using Implict and Explict waiting mechanism Link: WebDriver Wait Commands
  • 24. COMMONEXCEPTIONS ElementNotVisibleException : Use Javascript to make element visible IllegalLocatorException: when By.className() is used with a compound class name. NoSuchElementException: Use waits OR verify your locator StaleElementReferenceException: Happens if a DOM operation happening on the page is temporarily causing the element to be inaccessible. public boolean retryFindClick(By by) { boolean result = false; int attempts = 0; while(attempts < 2) { try { driver.findElement(by).click(); result = true; break; } catch(StaleElementException e) { } attempts++; } return result;
  • 25. IJAVASCRIPTEXECUTOR Used to execute javascript on webpage. Can be used for finding elements Performing actions like click or selecting control Syntax: IJavaScriptExecutor jsExec = (IJavaScriptExecutor)_driver; _searchTextField = (IWebElement)jsExec.ExecuteScript("return document.getElementBy _searchTextField.SendKeys(searchString);