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
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Essential Infomation Tech presentation.pptx
PPTX
ai tools demonstartion for schools and inter college
PDF
Nekopoi APK 2025 free lastest update
PPTX
Introduction to Artificial Intelligence
PDF
top salesforce developer skills in 2025.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
history of c programming in notes for students .pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
System and Network Administraation Chapter 3
PDF
System and Network Administration Chapter 2
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
How Creative Agencies Leverage Project Management Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Essential Infomation Tech presentation.pptx
ai tools demonstartion for schools and inter college
Nekopoi APK 2025 free lastest update
Introduction to Artificial Intelligence
top salesforce developer skills in 2025.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
history of c programming in notes for students .pptx
How to Migrate SBCGlobal Email to Yahoo Easily
Odoo POS Development Services by CandidRoot Solutions
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
System and Network Administraation Chapter 3
System and Network Administration Chapter 2
How to Choose the Right IT Partner for Your Business in Malaysia
Upgrade and Innovation Strategies for SAP ERP Customers
How Creative Agencies Leverage Project Management Software.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(); } }