SlideShare a Scribd company logo
Daniel Herken
dherken@browseemall.com
http://www.browseemall.com
How To Automate Cross Browser Testing
Automation
Today we will cover
1. When to automate?
2. Static page testing
3. Dynamic page testing
Introduction
Creating these automation tasks takes time and resources so make sure that:
• you need to support a high number of browsers
• you need to do regression tests multiple times
• you have a suitable test execution environment
• you have a clear plan when and how to execute the tests
When to automate?
Automation makes sense if the test need to be repeated often!
Define to number of browsers that need testing in advance.
When to automate?
Which browsers need testing?
• How to install a Selenium Grid
• Install ImageMagick for picture comparison
When to automate?
Requirements:
o Develop by using a known-good browser
o Use Selenium to take a known-good screenshot
o Use Selenium to take screenshots in all other browsers that need testing
o Use ImageMagick to compare these screenshots for problems
o Manually review the screenshot comparison for real problems
Static Page Testing
How to automate?
Static Page Testing
public static void TestGoogleHomepage()
{
// Create a screenshot with a known good browser first
IWebDriver chromeDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Chrome());
GetPageScreenshot(chromeDriver, Path.Combine(basePath, "chrome.png"));
// Create screenshots in the other browsers we need to support
IWebDriver firefoxDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Firefox());
GetPageScreenshot(firefoxDriver, Path.Combine(basePath, "firefox.png"));
// Create screenshot comparison
ScreenshotHelper.CreateComparison(Path.Combine(basePath, "chrome.png"), Path.Combine(basePath, "firefox.png"), Path.Combine(basePath, "fi
}
private static void GetPageScreenshot(IWebDriver driver, string screenshotPath)
{
// Change to the correct resolution
driver.Manage().Window.Size = new System.Drawing.Size(TestParameter.Width, TestParameter.Height);
// Open Homepage
driver.Navigate().GoToUrl(TestUrl);
// Take Screenshot
ScreenshotHelper.TakeScreenshot(driver, screenshotPath);
driver.Quit();
}
Static Page Testing
Demo
o Develop by using a known-good browser
o Use Selenium to automate all user interaction
o Take screenshots between each user interaction step
o Use ImageMagick to compare these screenshots for problems
o Manually review the screenshot comparison for real problems
Dynamic Page Testing
How to automate?
Dynamic Page Testing
public static void TestGoogleHomepage()
{
// Create a screenshot with a known good browser first
IWebDriver chromeDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Chrome());
GetPageScreenshot(chromeDriver, Path.Combine(basePath, "chrome.png"));
[…]
// Create screenshot comparison
ScreenshotHelper.CreateComparison(Path.Combine(basePath, "chrome.png"), Path.Combine(basePath, "firefox.png"), Path.Combine(basePath, "fi
}
private static void GetPageScreenshots(IWebDriver driver, string screenshotPath)
{
// Change to the correct resolution
driver.Manage().Window.Size = new System.Drawing.Size(TestParameter.Width, TestParameter.Height);
// Open Homepage
driver.Navigate().GoToUrl(TestUrl);
// Take Screenshot
ScreenshotHelper.TakeScreenshot(driver, screenshotPath[0], isFirefox);
// Do more user actions & take more screenshots
driver.Quit();
}
Dynamic Page Testing
Demo
TakeScreenshot();
public static void TakeScreenshot(IWebDriver driver, string path)
{
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)driver;
ITakesScreenshot takesScreenshot = (ITakesScreenshot)driver;
// Generate Bitmap
Image finalScreenshot = new Bitmap(TestParameter.Width, TestParameter.Height);
// Scroll to top
jsExecutor.ExecuteScript("window.scrollTo(0,0);", new object[] { });
byte[] screenshot = takesScreenshot.GetScreenshot().AsByteArray;
using (MemoryStream stream = new MemoryStream(screenshot))
{
Bitmap originalScreenshot = (Bitmap)Bitmap.FromStream(stream);
Bitmap parsedScreenshot = ResizeBitmap(originalScreenshot, TestParameter.Width, TestParameter.Height);
parsedScreenshot.Save(path, ImageFormat.Png);
parsedScreenshot.Dispose();
originalScreenshot.Dispose();
}
}
Questions?
Q & A

More Related Content

What's hot (20)

Protractor
Protractor
kapilsethi9
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Yuriy Gerasimov
 
Selenium
Selenium
Adam Goucher
 
Automated Web Testing With Selenium
Automated Web Testing With Selenium
Deepak Mittal
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Run Selenium Tests With Jenkins and BrowseEmAll
Run Selenium Tests With Jenkins and BrowseEmAll
Daniel Herken
 
Selenium By Pravin Mishra
Selenium By Pravin Mishra
Pravin Mishra
 
Using Selenium 3 0
Using Selenium 3 0
TEST Huddle
 
Selenium
Selenium
Ruturaj Doshi
 
Selenium Tips & Tricks
Selenium Tips & Tricks
Dave Haeffner
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applications
TSundberg
 
Automatic Functional Testing with Selenium and SauceLabs
Automatic Functional Testing with Selenium and SauceLabs
Joseph Chiang
 
Selenium
Selenium
Andrew Krug
 
Selenium IDE and Beyond
Selenium IDE and Beyond
Samit Badle
 
Presentation_Protractor
Presentation_Protractor
Umesh Randhe
 
Selenium Basics Crashcourse
Selenium Basics Crashcourse
Daniel Herken
 
Automated UI testing with Selenium
Automated UI testing with Selenium
Yuriy Gerasimov
 
Selenium Webdriver
Selenium Webdriver
Muhammad Bilal
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
Haitham Refaat
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Yuriy Gerasimov
 
Automated Web Testing With Selenium
Automated Web Testing With Selenium
Deepak Mittal
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Run Selenium Tests With Jenkins and BrowseEmAll
Run Selenium Tests With Jenkins and BrowseEmAll
Daniel Herken
 
Selenium By Pravin Mishra
Selenium By Pravin Mishra
Pravin Mishra
 
Using Selenium 3 0
Using Selenium 3 0
TEST Huddle
 
Selenium Tips & Tricks
Selenium Tips & Tricks
Dave Haeffner
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applications
TSundberg
 
Automatic Functional Testing with Selenium and SauceLabs
Automatic Functional Testing with Selenium and SauceLabs
Joseph Chiang
 
Selenium IDE and Beyond
Selenium IDE and Beyond
Samit Badle
 
Presentation_Protractor
Presentation_Protractor
Umesh Randhe
 
Selenium Basics Crashcourse
Selenium Basics Crashcourse
Daniel Herken
 
Automated UI testing with Selenium
Automated UI testing with Selenium
Yuriy Gerasimov
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
Haitham Refaat
 
Smarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 

Viewers also liked (6)

Cross browser testing using BrowserStack
Cross browser testing using BrowserStack
RapidValue
 
Automatização de testes funcionais com selenium etapa 1
Automatização de testes funcionais com selenium etapa 1
Cintia Armesto
 
Agile and Scrum for Video Game Development
Agile and Scrum for Video Game Development
Mike Cohn
 
Getting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & Appium
Sauce Labs
 
Automação de testes funcionais com selenium webdriver
Automação de testes funcionais com selenium webdriver
Qualister
 
Automação de Teste Funcionais - Selenium
Automação de Teste Funcionais - Selenium
Israel Santiago
 
Cross browser testing using BrowserStack
Cross browser testing using BrowserStack
RapidValue
 
Automatização de testes funcionais com selenium etapa 1
Automatização de testes funcionais com selenium etapa 1
Cintia Armesto
 
Agile and Scrum for Video Game Development
Agile and Scrum for Video Game Development
Mike Cohn
 
Getting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & Appium
Sauce Labs
 
Automação de testes funcionais com selenium webdriver
Automação de testes funcionais com selenium webdriver
Qualister
 
Automação de Teste Funcionais - Selenium
Automação de Teste Funcionais - Selenium
Israel Santiago
 
Ad

Similar to How To Automate Cross Browser Testing (20)

Automated Browser Testing
Automated Browser Testing
Darren Hickling MBCS
 
Visual regression testing
Visual regression testing
Liam McMurray
 
Making cross browser tests beautiful
Making cross browser tests beautiful
Meaghan Lewis
 
Selenium Automation Testing - A Complete Guide.pdf
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
Selenium Automation Testing - A Complete Guide.pdf
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
Browser-level testing
Browser-level testing
Martin Kleppmann
 
Selenium Automation Testing - A Complete Guide
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
Know All About Cross Browser Compatibility Testing.pdf
Know All About Cross Browser Compatibility Testing.pdf
flufftailshop
 
Cross browser Testing in the Era of Responsive Web Design (1).pptx
Cross browser Testing in the Era of Responsive Web Design (1).pptx
Leeanna marshall
 
Cross-Browser Testing : A Complete Guide
Cross-Browser Testing : A Complete Guide
Testgrid.io
 
Guide to Cross Browser Testing_ Definition, Process, Challenges & Tools.pdf
Guide to Cross Browser Testing_ Definition, Process, Challenges & Tools.pdf
Steve Wortham
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
kalichargn70th171
 
Cross Browser Compatibility Testing - A Complete Guide.pdf
Cross Browser Compatibility Testing - A Complete Guide.pdf
flufftailshop
 
Type Cross browsers testing
Type Cross browsers testing
Nguyễn Đào Thiên Thư
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
flufftailshop
 
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Badoo
 
Cross-Browser Testing With Automation.pdf
Cross-Browser Testing With Automation.pdf
Riley Claire
 
Web application automated testing types and tools
Web application automated testing types and tools
TestingXperts
 
Visual regression testing
Visual regression testing
Liam McMurray
 
Making cross browser tests beautiful
Making cross browser tests beautiful
Meaghan Lewis
 
Selenium Automation Testing - A Complete Guide.pdf
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
Selenium Automation Testing - A Complete Guide.pdf
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
Selenium Automation Testing - A Complete Guide
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
Know All About Cross Browser Compatibility Testing.pdf
Know All About Cross Browser Compatibility Testing.pdf
flufftailshop
 
Cross browser Testing in the Era of Responsive Web Design (1).pptx
Cross browser Testing in the Era of Responsive Web Design (1).pptx
Leeanna marshall
 
Cross-Browser Testing : A Complete Guide
Cross-Browser Testing : A Complete Guide
Testgrid.io
 
Guide to Cross Browser Testing_ Definition, Process, Challenges & Tools.pdf
Guide to Cross Browser Testing_ Definition, Process, Challenges & Tools.pdf
Steve Wortham
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
kalichargn70th171
 
Cross Browser Compatibility Testing - A Complete Guide.pdf
Cross Browser Compatibility Testing - A Complete Guide.pdf
flufftailshop
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
flufftailshop
 
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Badoo
 
Cross-Browser Testing With Automation.pdf
Cross-Browser Testing With Automation.pdf
Riley Claire
 
Web application automated testing types and tools
Web application automated testing types and tools
TestingXperts
 
Ad

Recently uploaded (20)

Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Migrating to Azure Cosmos DB the Right Way
Migrating to Azure Cosmos DB the Right Way
Alexander (Alex) Komyagin
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
 
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
Microsoft Business-230T01A-ENU-PowerPoint_01.pptx
soulamaabdoulaye128
 
Making significant Software Architecture decisions
Making significant Software Architecture decisions
Bert Jan Schrijver
 
Software Testing & it’s types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
Women in Tech: Marketo Engage User Group - June 2025 - AJO with AWS
BradBedford3
 
Generative Artificial Intelligence and its Applications
Generative Artificial Intelligence and its Applications
SandeepKS52
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
What is data visualization and how data visualization tool can help.pdf
What is data visualization and how data visualization tool can help.pdf
Varsha Nayak
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
 
Advanced Token Development - Decentralized Innovation
Advanced Token Development - Decentralized Innovation
arohisinghas720
 

How To Automate Cross Browser Testing

  • 2. Today we will cover 1. When to automate? 2. Static page testing 3. Dynamic page testing Introduction
  • 3. Creating these automation tasks takes time and resources so make sure that: • you need to support a high number of browsers • you need to do regression tests multiple times • you have a suitable test execution environment • you have a clear plan when and how to execute the tests When to automate? Automation makes sense if the test need to be repeated often!
  • 4. Define to number of browsers that need testing in advance. When to automate? Which browsers need testing?
  • 5. • How to install a Selenium Grid • Install ImageMagick for picture comparison When to automate? Requirements:
  • 6. o Develop by using a known-good browser o Use Selenium to take a known-good screenshot o Use Selenium to take screenshots in all other browsers that need testing o Use ImageMagick to compare these screenshots for problems o Manually review the screenshot comparison for real problems Static Page Testing How to automate?
  • 7. Static Page Testing public static void TestGoogleHomepage() { // Create a screenshot with a known good browser first IWebDriver chromeDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Chrome()); GetPageScreenshot(chromeDriver, Path.Combine(basePath, "chrome.png")); // Create screenshots in the other browsers we need to support IWebDriver firefoxDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Firefox()); GetPageScreenshot(firefoxDriver, Path.Combine(basePath, "firefox.png")); // Create screenshot comparison ScreenshotHelper.CreateComparison(Path.Combine(basePath, "chrome.png"), Path.Combine(basePath, "firefox.png"), Path.Combine(basePath, "fi } private static void GetPageScreenshot(IWebDriver driver, string screenshotPath) { // Change to the correct resolution driver.Manage().Window.Size = new System.Drawing.Size(TestParameter.Width, TestParameter.Height); // Open Homepage driver.Navigate().GoToUrl(TestUrl); // Take Screenshot ScreenshotHelper.TakeScreenshot(driver, screenshotPath); driver.Quit(); }
  • 9. o Develop by using a known-good browser o Use Selenium to automate all user interaction o Take screenshots between each user interaction step o Use ImageMagick to compare these screenshots for problems o Manually review the screenshot comparison for real problems Dynamic Page Testing How to automate?
  • 10. Dynamic Page Testing public static void TestGoogleHomepage() { // Create a screenshot with a known good browser first IWebDriver chromeDriver = new RemoteWebDriver(TestParameter.SeleniumHubUrl, DesiredCapabilities.Chrome()); GetPageScreenshot(chromeDriver, Path.Combine(basePath, "chrome.png")); […] // Create screenshot comparison ScreenshotHelper.CreateComparison(Path.Combine(basePath, "chrome.png"), Path.Combine(basePath, "firefox.png"), Path.Combine(basePath, "fi } private static void GetPageScreenshots(IWebDriver driver, string screenshotPath) { // Change to the correct resolution driver.Manage().Window.Size = new System.Drawing.Size(TestParameter.Width, TestParameter.Height); // Open Homepage driver.Navigate().GoToUrl(TestUrl); // Take Screenshot ScreenshotHelper.TakeScreenshot(driver, screenshotPath[0], isFirefox); // Do more user actions & take more screenshots driver.Quit(); }
  • 12. TakeScreenshot(); public static void TakeScreenshot(IWebDriver driver, string path) { IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)driver; ITakesScreenshot takesScreenshot = (ITakesScreenshot)driver; // Generate Bitmap Image finalScreenshot = new Bitmap(TestParameter.Width, TestParameter.Height); // Scroll to top jsExecutor.ExecuteScript("window.scrollTo(0,0);", new object[] { }); byte[] screenshot = takesScreenshot.GetScreenshot().AsByteArray; using (MemoryStream stream = new MemoryStream(screenshot)) { Bitmap originalScreenshot = (Bitmap)Bitmap.FromStream(stream); Bitmap parsedScreenshot = ResizeBitmap(originalScreenshot, TestParameter.Width, TestParameter.Height); parsedScreenshot.Save(path, ImageFormat.Png); parsedScreenshot.Dispose(); originalScreenshot.Dispose(); } }