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

PPTX
Guide To Effective Cross Browser Testing
PPTX
Run Selenium Tests With Microsoft Test Manager
PPTX
Get Started With Selenium 3 and Selenium 3 Grid
PPTX
Cross browser testing
PPTX
Selenium
PPTX
Cross browser Testing JavaScript
PDF
How To Use Selenium Successfully (Java Edition)
PDF
Web automation using selenium.ppt
Guide To Effective Cross Browser Testing
Run Selenium Tests With Microsoft Test Manager
Get Started With Selenium 3 and Selenium 3 Grid
Cross browser testing
Selenium
Cross browser Testing JavaScript
How To Use Selenium Successfully (Java Edition)
Web automation using selenium.ppt

What's hot (20)

PPTX
Protractor
ODP
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
PPT
Selenium
PDF
Automated Web Testing With Selenium
ODP
Mastering selenium for automated acceptance tests
PPTX
Run Selenium Tests With Jenkins and BrowseEmAll
PPT
Selenium By Pravin Mishra
PDF
Using Selenium 3 0
PPT
Selenium
PDF
Selenium Tips & Tricks
PPTX
Selenium WebDriver - Test automation for web applications
PDF
Automatic Functional Testing with Selenium and SauceLabs
PPTX
Selenium
PDF
Selenium IDE and Beyond
PPTX
Presentation_Protractor
PPTX
Selenium Basics Crashcourse
ODP
Automated UI testing with Selenium
PPTX
Selenium Webdriver
PPTX
Protractor Testing Automation Tool Framework / Jasmine Reporters
PPTX
Smarter ways to do selenium automation @ work, Selenium, automation
Protractor
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Selenium
Automated Web Testing With Selenium
Mastering selenium for automated acceptance tests
Run Selenium Tests With Jenkins and BrowseEmAll
Selenium By Pravin Mishra
Using Selenium 3 0
Selenium
Selenium Tips & Tricks
Selenium WebDriver - Test automation for web applications
Automatic Functional Testing with Selenium and SauceLabs
Selenium
Selenium IDE and Beyond
Presentation_Protractor
Selenium Basics Crashcourse
Automated UI testing with Selenium
Selenium Webdriver
Protractor Testing Automation Tool Framework / Jasmine Reporters
Smarter ways to do selenium automation @ work, Selenium, automation
Ad

Viewers also liked (6)

PDF
Cross browser testing using BrowserStack
PPTX
Automatização de testes funcionais com selenium etapa 1
PDF
Agile and Scrum for Video Game Development
PPTX
Getting Started with Mobile Test Automation & Appium
PDF
Automação de testes funcionais com selenium webdriver
PPTX
Automação de Teste Funcionais - Selenium
Cross browser testing using BrowserStack
Automatização de testes funcionais com selenium etapa 1
Agile and Scrum for Video Game Development
Getting Started with Mobile Test Automation & Appium
Automação de testes funcionais com selenium webdriver
Automação de Teste Funcionais - Selenium
Ad

Similar to How To Automate Cross Browser Testing (20)

PPTX
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
PDF
Visual Regression Testing Using Playwright.pdf
PPTX
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
PPTX
Getting up and running with selenium for automated Code palousa
PDF
Web UI test automation instruments
PDF
Playwright Testing Guide for QA Engineers.pdf
PPTX
Selenium.pptx
PDF
Complete_QA_Automation_Guide__1696637878.pdf
PDF
Design Patterns in Automation Framework.pdf
PPTX
Qa process
PPTX
Qa process
PDF
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
PPTX
Protractor framework architecture with example
DOC
Qtp complete guide for all
DOC
Qtp basics
PDF
UI Testing Automation
PPTX
Protractor overview
PPTX
From Point & Click to Pinch & Zoom by Dan Rabinovitz
PDF
Selenium With Spices
PDF
Selenium Full Material( apprendre Selenium).pdf
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Visual Regression Testing Using Playwright.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
Getting up and running with selenium for automated Code palousa
Web UI test automation instruments
Playwright Testing Guide for QA Engineers.pdf
Selenium.pptx
Complete_QA_Automation_Guide__1696637878.pdf
Design Patterns in Automation Framework.pdf
Qa process
Qa process
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Protractor framework architecture with example
Qtp complete guide for all
Qtp basics
UI Testing Automation
Protractor overview
From Point & Click to Pinch & Zoom by Dan Rabinovitz
Selenium With Spices
Selenium Full Material( apprendre Selenium).pdf

Recently uploaded (20)

PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
System and Network Administraation Chapter 3
PPTX
Transform Your Business with a Software ERP System
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
PTS Company Brochure 2025 (1).pdf.......
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Reimagine Home Health with the Power of Agentic AI​
Navsoft: AI-Powered Business Solutions & Custom Software Development
Computer Software and OS of computer science of grade 11.pptx
Designing Intelligence for the Shop Floor.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
top salesforce developer skills in 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
iTop VPN Free 5.6.0.5262 Crack latest version 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
System and Network Administraation Chapter 3
Transform Your Business with a Software ERP System
Odoo Companies in India – Driving Business Transformation.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
PTS Company Brochure 2025 (1).pdf.......

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(); } }