SlideShare a Scribd company logo
1 of 28
Daniel Herken
dherken@browseemall.com
http://www.browseemall.com
Get Started With Selenium 3
Selenium 3
Today we will cover
1. What is Selenium?
2. How to setup a testing environment
3. Running your first test
4. Working with Selenium Grid
5. Simplify with the BrowseEmAll Grid
6. Q/A Session
Introduction
Supported by all major browser vendors:
What is Selenium?
Free and open source browser automation framework.
What is Selenium?
How does it work?
Your Code
What is Selenium?
How does it work?
Your Code Selenium
What is Selenium?
How does it work?
Your Code Selenium
IEDriver
Edge
Driver
Firefox
Driver
Chrome
Driver
What is Selenium?
How does it work?
Your Code Selenium
IEDriver
Edge
Driver
Firefox
Driver
Chrome
Driver
Internet
Explorer
Microsoft
Edge
Firefox
Chrome
Supports automation of all major browsers:
What is Selenium?
Which browsers are supported?
Selenium language bindings are available for:
• Java
• C#
• Ruby
• Python
• JavaScript
• Perl (third-party)
• PHP (third-party)
What is Selenium?
Which programming languages are supported?
• Install Firefox: https://www.mozilla.org
• Install Google Chrome: https://www.google.com/chrome/browser/desktop/
• Add c:Selenium (or similar path on macOS / Linux) to your PATH
Setup Selenium
Requirements
o Internet Explorer Driver:
• Download (32bit or 64bit) http://www.seleniumhq.org/download/
• Extract to c:Selenium
o Edge Driver:
• Download https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
• Copy to c:Selenium
o Chrome Driver:
• Download https://sites.google.com/a/chromium.org/chromedriver/
• Copy to c:Selenium
o Firefox Driver:
• Download https://github.com/mozilla/geckodriver/releases
• Extract to c:Selenium
Setup Selenium
Installing Drivers
A Simple Test
Running a simple Google query
[TestMethod]
public void GoogleForSelenium()
{
// Launch new instance for Firefox
IWebDriver driver = new FirefoxDriver();
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
// Find the input field for the search query
IWebElement inputField = driver.FindElement(By.Name("q"));
// Add some text to the input field
inputField.SendKeys("Selenium");
// Submit the search
inputField.Submit();
// Google uses JS to render the results page so we need to wait
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// Use asserts like you would in unit tests
Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// close down the browser
driver.Quit();
}
A Simple Test
Demo
A Simple Test
[TestMethod]
public void GoogleForSelenium_Chrome()
{
IWebDriver driver = new ChromeDriver();
GoogleForSelenium(driver);
}
[TestMethod]
public void GoogleForSelenium_Edge()
{
IWebDriver driver = new EdgeDriver();
GoogleForSelenium(driver);
}
[TestMethod]
public void GoogleForSelenium_InternetExplorer()
{
IWebDriver driver = new InternetExplorerDriver();
GoogleForSelenium(driver);
}
public void GoogleForSelenium(IWebDriver driver)
{
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
A Simple Test
Demo
Selenium Grid can be used to run Selenium tests parallel and on multiple machines. This helps with:
• Reducing the overall time of test execution
• Running tests against browsers on different operating systems
Selenium Grid
What is Selenium Grid?
Selenium Grid
Your Code
Selenium Grid
How does it work?
Your Code
Remote
Driver
Selenium Grid
How does it work?
Your Code
Remote
Driver
Selenium
Hub
Selenium Grid
How does it work?
Your Code
Remote
Driver
Selenium
Hub
Selenium
Node
Selenium
Node
Selenium
Node
1. Download Java: https://www.java.com/en/download/
2. Download Selenium Standalone Server: http://www.seleniumhq.org/download/
• Copy to c:Selenium
3. Start the Hub with the command line:
• java -jar selenium-server-standalone-3.0.1.jar -role hub
4. Grid console available at: http://localhost:4444/grid/console
Selenium Grid
Setup a Hub
1. Create a node configuration file:
{ "capabilities": [{
"browserName": "firefox",
"platform": "WINDOWS",
"maxInstances": 1
}],
"maxSession": 5,
"port": 5555,
"register": true
}
2. Start the Node with the command line:
• java -jar selenium-server-standalone-3.0.1.jar -role node -hub
http://localhost:4444/grid/register -nodeConfig node.json
Selenium Grid
Setup a Node
Selenium Grid
[TestMethod]
public void GoogleForSeleniumOnGrid()
{
// Launch new instance for Firefox
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox());
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
// Find the input field for the search query
IWebElement inputField = driver.FindElement(By.Name("q"));
// Add some text to the input field
inputField.SendKeys("Selenium");
// Submit the search
inputField.Submit();
// Google uses JS to render the results page so we need to wait
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// Use asserts like you would in unit tests
Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// close down the browser
driver.Quit();
}
Selenium Grid
Demo
BrowseEmAll Grid
BrowseEmAll Grid
[TestMethod]
public void GoogleForSeleniumOnGrid()
{
// Launch new instance for Firefox
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox());
// Navigate to google
driver.Navigate().GoToUrl("http://www.google.com");
// Find the input field for the search query
IWebElement inputField = driver.FindElement(By.Name("q"));
// Add some text to the input field
inputField.SendKeys("Selenium");
// Submit the search
inputField.Submit();
// Google uses JS to render the results page so we need to wait
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// Use asserts like you would in unit tests
Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase));
// close down the browser
driver.Quit();
}
BrowseEmAll Grid
Demo
Questions?
Q & A

More Related Content

What's hot

Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Yuriy Gerasimov
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumDeepak Mittal
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.pptAna Sarbescu
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introductionPankaj Dubey
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationRIA RUI Society
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with SeleniumKerry Buckley
 
Selenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingSelenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingDisha Srivastava
 
Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and BeyondSamit Badle
 
Automated UI testing with Selenium
Automated UI testing with SeleniumAutomated UI testing with Selenium
Automated UI testing with SeleniumYuriy Gerasimov
 

What's hot (20)

Selenium with java
Selenium with javaSelenium with java
Selenium with java
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Selenium Webdriver
Selenium WebdriverSelenium Webdriver
Selenium Webdriver
 
Web automation using selenium.ppt
Web automation using selenium.pptWeb automation using selenium.ppt
Web automation using selenium.ppt
 
Selenium IDE features
Selenium IDE featuresSelenium IDE features
Selenium IDE features
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Demo
Selenium DemoSelenium Demo
Selenium Demo
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
Selenium
SeleniumSelenium
Selenium
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Selenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and WorkingSelenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and Working
 
Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and Beyond
 
Automated UI testing with Selenium
Automated UI testing with SeleniumAutomated UI testing with Selenium
Automated UI testing with Selenium
 

Similar to Get Started With Selenium 3 and Selenium 3 Grid

Run Selenium Tests With Microsoft Test Manager
Run Selenium Tests With Microsoft Test ManagerRun Selenium Tests With Microsoft Test Manager
Run Selenium Tests With Microsoft Test ManagerDaniel Herken
 
Selenium 101 Webinar
Selenium 101 WebinarSelenium 101 Webinar
Selenium 101 WebinarDaniel Herken
 
Cross platform browser automation tests sdp
Cross platform browser automation tests   sdpCross platform browser automation tests   sdp
Cross platform browser automation tests sdpOren Ashkenazy
 
Selenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaEr. Sndp Srda
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具政億 林
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with AppiumLuke Maung
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.comtestingbot
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試 政億 林
 
Introduction to Selenium and WebDriver
Introduction to Selenium and WebDriverIntroduction to Selenium and WebDriver
Introduction to Selenium and WebDriverTechWell
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
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
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialAlan Richardson
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterBoni García
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjugPhilip Schlesinger
 
Browser-Based testing using Selenium
Browser-Based testing using SeleniumBrowser-Based testing using Selenium
Browser-Based testing using Seleniumret0
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousaEmma Armstrong
 

Similar to Get Started With Selenium 3 and Selenium 3 Grid (20)

Run Selenium Tests With Microsoft Test Manager
Run Selenium Tests With Microsoft Test ManagerRun Selenium Tests With Microsoft Test Manager
Run Selenium Tests With Microsoft Test Manager
 
Selenium 101 Webinar
Selenium 101 WebinarSelenium 101 Webinar
Selenium 101 Webinar
 
Selenium
SeleniumSelenium
Selenium
 
Cross platform browser automation tests sdp
Cross platform browser automation tests   sdpCross platform browser automation tests   sdp
Cross platform browser automation tests sdp
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep ShardaSelenium Introduction by Sandeep Sharda
Selenium Introduction by Sandeep Sharda
 
探討Web ui自動化測試工具
探討Web ui自動化測試工具探討Web ui自動化測試工具
探討Web ui自動化測試工具
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試
 
Introduction to Selenium and WebDriver
Introduction to Selenium and WebDriverIntroduction to Selenium and WebDriver
Introduction to Selenium and WebDriver
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
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)
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver Tutorial
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug
 
Browser-Based testing using Selenium
Browser-Based testing using SeleniumBrowser-Based testing using Selenium
Browser-Based testing using Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousa
 

Recently uploaded

Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 

Recently uploaded (20)

Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 

Get Started With Selenium 3 and Selenium 3 Grid

  • 2. Today we will cover 1. What is Selenium? 2. How to setup a testing environment 3. Running your first test 4. Working with Selenium Grid 5. Simplify with the BrowseEmAll Grid 6. Q/A Session Introduction
  • 3. Supported by all major browser vendors: What is Selenium? Free and open source browser automation framework.
  • 4. What is Selenium? How does it work? Your Code
  • 5. What is Selenium? How does it work? Your Code Selenium
  • 6. What is Selenium? How does it work? Your Code Selenium IEDriver Edge Driver Firefox Driver Chrome Driver
  • 7. What is Selenium? How does it work? Your Code Selenium IEDriver Edge Driver Firefox Driver Chrome Driver Internet Explorer Microsoft Edge Firefox Chrome
  • 8. Supports automation of all major browsers: What is Selenium? Which browsers are supported?
  • 9. Selenium language bindings are available for: • Java • C# • Ruby • Python • JavaScript • Perl (third-party) • PHP (third-party) What is Selenium? Which programming languages are supported?
  • 10. • Install Firefox: https://www.mozilla.org • Install Google Chrome: https://www.google.com/chrome/browser/desktop/ • Add c:Selenium (or similar path on macOS / Linux) to your PATH Setup Selenium Requirements
  • 11. o Internet Explorer Driver: • Download (32bit or 64bit) http://www.seleniumhq.org/download/ • Extract to c:Selenium o Edge Driver: • Download https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ • Copy to c:Selenium o Chrome Driver: • Download https://sites.google.com/a/chromium.org/chromedriver/ • Copy to c:Selenium o Firefox Driver: • Download https://github.com/mozilla/geckodriver/releases • Extract to c:Selenium Setup Selenium Installing Drivers
  • 12. A Simple Test Running a simple Google query [TestMethod] public void GoogleForSelenium() { // Launch new instance for Firefox IWebDriver driver = new FirefoxDriver(); // Navigate to google driver.Navigate().GoToUrl("http://www.google.com"); // Find the input field for the search query IWebElement inputField = driver.FindElement(By.Name("q")); // Add some text to the input field inputField.SendKeys("Selenium"); // Submit the search inputField.Submit(); // Google uses JS to render the results page so we need to wait var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // Use asserts like you would in unit tests Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // close down the browser driver.Quit(); }
  • 14. A Simple Test [TestMethod] public void GoogleForSelenium_Chrome() { IWebDriver driver = new ChromeDriver(); GoogleForSelenium(driver); } [TestMethod] public void GoogleForSelenium_Edge() { IWebDriver driver = new EdgeDriver(); GoogleForSelenium(driver); } [TestMethod] public void GoogleForSelenium_InternetExplorer() { IWebDriver driver = new InternetExplorerDriver(); GoogleForSelenium(driver); } public void GoogleForSelenium(IWebDriver driver) { // Navigate to google driver.Navigate().GoToUrl("http://www.google.com");
  • 16. Selenium Grid can be used to run Selenium tests parallel and on multiple machines. This helps with: • Reducing the overall time of test execution • Running tests against browsers on different operating systems Selenium Grid What is Selenium Grid?
  • 18. Selenium Grid How does it work? Your Code Remote Driver
  • 19. Selenium Grid How does it work? Your Code Remote Driver Selenium Hub
  • 20. Selenium Grid How does it work? Your Code Remote Driver Selenium Hub Selenium Node Selenium Node Selenium Node
  • 21. 1. Download Java: https://www.java.com/en/download/ 2. Download Selenium Standalone Server: http://www.seleniumhq.org/download/ • Copy to c:Selenium 3. Start the Hub with the command line: • java -jar selenium-server-standalone-3.0.1.jar -role hub 4. Grid console available at: http://localhost:4444/grid/console Selenium Grid Setup a Hub
  • 22. 1. Create a node configuration file: { "capabilities": [{ "browserName": "firefox", "platform": "WINDOWS", "maxInstances": 1 }], "maxSession": 5, "port": 5555, "register": true } 2. Start the Node with the command line: • java -jar selenium-server-standalone-3.0.1.jar -role node -hub http://localhost:4444/grid/register -nodeConfig node.json Selenium Grid Setup a Node
  • 23. Selenium Grid [TestMethod] public void GoogleForSeleniumOnGrid() { // Launch new instance for Firefox IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox()); // Navigate to google driver.Navigate().GoToUrl("http://www.google.com"); // Find the input field for the search query IWebElement inputField = driver.FindElement(By.Name("q")); // Add some text to the input field inputField.SendKeys("Selenium"); // Submit the search inputField.Submit(); // Google uses JS to render the results page so we need to wait var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // Use asserts like you would in unit tests Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // close down the browser driver.Quit(); }
  • 26. BrowseEmAll Grid [TestMethod] public void GoogleForSeleniumOnGrid() { // Launch new instance for Firefox IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), DesiredCapabilities.Firefox()); // Navigate to google driver.Navigate().GoToUrl("http://www.google.com"); // Find the input field for the search query IWebElement inputField = driver.FindElement(By.Name("q")); // Add some text to the input field inputField.SendKeys("Selenium"); // Submit the search inputField.Submit(); // Google uses JS to render the results page so we need to wait var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); wait.Until(o => o.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // Use asserts like you would in unit tests Assert.IsTrue(driver.Title.StartsWith("Selenium", StringComparison.OrdinalIgnoreCase)); // close down the browser driver.Quit(); }