SlideShare a Scribd company logo
Test Automation
• UI Automation Quirks
• Break
• Scalable Test Automation
Agenda
UI Automation Quirks
LinkedIn
• http://www.linkedin.com/in/lucaspang
Twitter
• http://www.twitter.com/bdcareers
Website
• http://www.builddirect.com/careers
About Me
Testing Pyramid
Never forget the pyramid!
• Target audience is for people who have experience using Selenium
WebDriver
• At BuildDirect we use:
• Selenium WebDriver for desktop
• http://www.seleniumhq.org
• Appium for mobile/tablet
• http://appium.io
• My experience is with C# bindings only. Other languages should be similar.
Background
• Methods to increase code re-use
• Learn some differences between various browsers
• Learn from BD experiences
Goals of this Talk
Statement
• I do not want my test runs interrupted by any OS level dialog windows
Sample
Problem
• iOS automatically downloads and prompts for update
iOS
Workaround
• Disable it!
iOS
Statement
• I want to run custom javascript during my test to do different actions (like
open a new browser window).
Sample
Problem
• iOS restricts this due to security reasons
iOS
((IJavaScriptExecutor)Driver).ExecuteScript("window.open();");
Workaround
• Skip tests that run on iOS devices
or
• If you’re running tests against a simulator, Appium has a capability option to
allow Safari to open new browsers
iOS
var dc = DesiredCapabilities.IPhone();
dc.SetCapability(“safariAllowPopups", “true");
Statement
• I want to send “action” keys to a textbox to cause a Javascript blur event
Sample
Problem
• Some keys will send an emoji character instead
• Tab will send
iOS
Driver.FindElement(By.Id(“username")).SendKeys(Keys.Tab);
Workaround
• We were using the Keys.Tab to cause a Javascript blur event
• We were able to do the same by changing focus to another element
iOS
Statement
• I want to easily interact with elements on Android devices
Sample
Problem
• Sometimes, elements cannot be interacted with if they are not in the view
Android
Driver.FindElement(By.Id("loginButton")).Click();
Workaround
• Add scrolling functionality to prior to clicking on element
• Install a keyboard app called “Null Keyboard” that permanently hides the
keyboard
• Appium has a method to close the keyboard
Android
var ele = Driver.FindElement(By.Id("loginButton"));
var js = (IJavaScriptExecutor) Driver;
js.ExecuteScript("arguments[0].scrollIntoView(true);", ele);
Statement
• I want to click on the element so that I can do actions on IE browser
Sample
Problem
• Sometimes IE will not execute the click properly and the view will not change
Internet Explorer
Driver.FindElement(By.Id("loginButton")).Click();
Workaround
• Wrap the Click() method and have it retry if first click failed
Internet Explorer
driver.FindElement(elementToClick).Click();
// element still on screen, retry only when testing using IE
if (driver.FindElement(elementToClick) != null && driver is InternetExplorerDriver)
{
driver.FindElement(elementToClick).Click();
}
Statement
• I want to be able to delete all the cookies so my browser has a clean session
before running the test
Sample
Problem
• IE cannot manipulate httpOnly cookies
Internet Explorer
Driver.Manage().Cookies.DeleteAllCookies();
Workaround
• When instantiating the InternetExplorerDriver we can set options to ensure
that the session is cleared
• Note that his means you have to start a new browser for each test
Internet Explorer
var opts = new InternetExplorerOptions
{
EnsureCleanSession = true
};
Driver = new InternetExplorerDriver(opts);
Statement
• I want to write my automation once so I don’t have to have special code
paths for different device views
Sample
Problem
• A responsive view might have multiple elements with the same locator value
and your FindElement() might not get the one you want
Responsive Design
Driver.FindElement(By.Id("loginButton"));
Workaround
• Use the same locator value for all the designs
• From the test make sure your FindElement searches for Displayed == true
elements only
• Add special helper variables to help determine if you are in mobile, tablet, or
desktop view
• Limit use of these though as it could increase test maintenance work
Responsive Design
Driver.FindElements(By.Id("loginButton")).First(e => e.Displayed);
Statement
• I am running tests remotely and want screenshots during test run for
debugging
Problem
• Screenshots can increase test run time. Some devices/browsers more than
others
• IE takes a full webpage by taking multiple screenshots and combining them
• Android/iOS devices are slow when taking screenshots
Screenshots
Workaround
• Only take screenshots on failed steps
• Have a way to easily toggle screenshots on or off
Screenshots
• Each browser has its own quirks
• Be flexible in your automation design
• Limit the amount of browser specific code
Summary
Questions?

More Related Content

PPTX
How to scale your Test Automation
PPTX
Reaching for Your Quality Stretch Goals: Testing at Realtor.com
PPTX
5 Considerations When Adopting Automated Testing
PPTX
Test Automation Architecture That Works by Bhupesh Dahal
PPT
Automation With A Tool Demo
PDF
Perils of Page-Object Pattern
PDF
The limits of unit testing by Craig Stuntz
PPTX
ISTQB Foundation and Selenium Java Automation Testing
How to scale your Test Automation
Reaching for Your Quality Stretch Goals: Testing at Realtor.com
5 Considerations When Adopting Automated Testing
Test Automation Architecture That Works by Bhupesh Dahal
Automation With A Tool Demo
Perils of Page-Object Pattern
The limits of unit testing by Craig Stuntz
ISTQB Foundation and Selenium Java Automation Testing

What's hot (20)

PPTX
Roman iovlev battle - JDI vs Selenide - Selenium Camp
PPTX
Test Automation Frameworks: Assumptions, Concepts & Tools
PDF
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
PDF
Web Accessibility Testing Trends and Shift Left Testing of accessibility usin...
PPTX
QAorHighway2016
PDF
Stop Testing (Only) The Functionality of Your Mobile Apps!
PPTX
Agile Testing Dilemmas
PPT
Automation testing
PPTX
Sustainable Automation Frameworks by Kelsey Shannahan
PDF
Test automation - What? Why? How?
PPTX
Automation Testing
PPTX
A Look into Automated Web UI Test
PPTX
Test automation lesson
PDF
Using The Page Object Pattern
PPTX
UI Test Automation - Maximizing ROI by Minimizing Maintenance Costs
PDF
30 of the best free software test tools in 60 minutes by Jess Lancaster
PPT
Challenges faced in UI automation
PPTX
An easy way to automate complex UI
PDF
Introduction to UI Automation Framework
PPTX
Colorful world-of-visual-automation-testing-latest
Roman iovlev battle - JDI vs Selenide - Selenium Camp
Test Automation Frameworks: Assumptions, Concepts & Tools
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Web Accessibility Testing Trends and Shift Left Testing of accessibility usin...
QAorHighway2016
Stop Testing (Only) The Functionality of Your Mobile Apps!
Agile Testing Dilemmas
Automation testing
Sustainable Automation Frameworks by Kelsey Shannahan
Test automation - What? Why? How?
Automation Testing
A Look into Automated Web UI Test
Test automation lesson
Using The Page Object Pattern
UI Test Automation - Maximizing ROI by Minimizing Maintenance Costs
30 of the best free software test tools in 60 minutes by Jess Lancaster
Challenges faced in UI automation
An easy way to automate complex UI
Introduction to UI Automation Framework
Colorful world-of-visual-automation-testing-latest
Ad

Viewers also liked (6)

PPTX
Coded UI - Test automation Practices from the Field
PDF
UI Test Automation Effectiveness
KEY
Effectively Using UI Automation
PDF
Web UI test automation instruments
PDF
UI test automation techniques by an example of JavaFX UI
PDF
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
Coded UI - Test automation Practices from the Field
UI Test Automation Effectiveness
Effectively Using UI Automation
Web UI test automation instruments
UI test automation techniques by an example of JavaFX UI
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
Ad

Similar to UI Automation Quirks (20)

PDF
Web driver selenium simplified
PPTX
Web driver training
PPTX
Web testing with Selenium
PDF
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
PDF
Build Fail-Proof Tests in Any Browser with Selenium
PDF
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
PPTX
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
PPT
Automation with Selenium Presented by Quontra Solutions
PPTX
Selenium.pptx
PDF
Prevent Test Automation Shelfware: A Selenium-WebDriver Case Study
PPTX
CS02A - Interacting with applications.pptx
PPTX
Testing ASP.NET - Progressive.NET
PPTX
Writing Well Abstracted Automation on Foundations of Jello
PDF
Intelligent Testing Tool: Selenium Web Driver
PPT
selenium.ppt
PPT
selenium.ppt
PPT
selenium.ppt
PPTX
Cross Platform Appium Tests: How To
PDF
Browser-level testing
PPTX
Web UI Tests: Introduce UI tests using Selenium
Web driver selenium simplified
Web driver training
Web testing with Selenium
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Build Fail-Proof Tests in Any Browser with Selenium
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Automation with Selenium Presented by Quontra Solutions
Selenium.pptx
Prevent Test Automation Shelfware: A Selenium-WebDriver Case Study
CS02A - Interacting with applications.pptx
Testing ASP.NET - Progressive.NET
Writing Well Abstracted Automation on Foundations of Jello
Intelligent Testing Tool: Selenium Web Driver
selenium.ppt
selenium.ppt
selenium.ppt
Cross Platform Appium Tests: How To
Browser-level testing
Web UI Tests: Introduce UI tests using Selenium

Recently uploaded (20)

PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Sustainable Sites - Green Building Construction
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PPT on Performance Review to get promotions
PPT
Project quality management in manufacturing
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Well-logging-methods_new................
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
additive manufacturing of ss316l using mig welding
DOCX
573137875-Attendance-Management-System-original
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Geodesy 1.pptx...............................................
OOP with Java - Java Introduction (Basics)
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CYBER-CRIMES AND SECURITY A guide to understanding
Lesson 3_Tessellation.pptx finite Mathematics
Sustainable Sites - Green Building Construction
bas. eng. economics group 4 presentation 1.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPT on Performance Review to get promotions
Project quality management in manufacturing
Internet of Things (IOT) - A guide to understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Well-logging-methods_new................
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
additive manufacturing of ss316l using mig welding
573137875-Attendance-Management-System-original

UI Automation Quirks

  • 2. • UI Automation Quirks • Break • Scalable Test Automation Agenda
  • 6. • Target audience is for people who have experience using Selenium WebDriver • At BuildDirect we use: • Selenium WebDriver for desktop • http://www.seleniumhq.org • Appium for mobile/tablet • http://appium.io • My experience is with C# bindings only. Other languages should be similar. Background
  • 7. • Methods to increase code re-use • Learn some differences between various browsers • Learn from BD experiences Goals of this Talk
  • 8. Statement • I do not want my test runs interrupted by any OS level dialog windows Sample Problem • iOS automatically downloads and prompts for update iOS
  • 10. Statement • I want to run custom javascript during my test to do different actions (like open a new browser window). Sample Problem • iOS restricts this due to security reasons iOS ((IJavaScriptExecutor)Driver).ExecuteScript("window.open();");
  • 11. Workaround • Skip tests that run on iOS devices or • If you’re running tests against a simulator, Appium has a capability option to allow Safari to open new browsers iOS var dc = DesiredCapabilities.IPhone(); dc.SetCapability(“safariAllowPopups", “true");
  • 12. Statement • I want to send “action” keys to a textbox to cause a Javascript blur event Sample Problem • Some keys will send an emoji character instead • Tab will send iOS Driver.FindElement(By.Id(“username")).SendKeys(Keys.Tab);
  • 13. Workaround • We were using the Keys.Tab to cause a Javascript blur event • We were able to do the same by changing focus to another element iOS
  • 14. Statement • I want to easily interact with elements on Android devices Sample Problem • Sometimes, elements cannot be interacted with if they are not in the view Android Driver.FindElement(By.Id("loginButton")).Click();
  • 15. Workaround • Add scrolling functionality to prior to clicking on element • Install a keyboard app called “Null Keyboard” that permanently hides the keyboard • Appium has a method to close the keyboard Android var ele = Driver.FindElement(By.Id("loginButton")); var js = (IJavaScriptExecutor) Driver; js.ExecuteScript("arguments[0].scrollIntoView(true);", ele);
  • 16. Statement • I want to click on the element so that I can do actions on IE browser Sample Problem • Sometimes IE will not execute the click properly and the view will not change Internet Explorer Driver.FindElement(By.Id("loginButton")).Click();
  • 17. Workaround • Wrap the Click() method and have it retry if first click failed Internet Explorer driver.FindElement(elementToClick).Click(); // element still on screen, retry only when testing using IE if (driver.FindElement(elementToClick) != null && driver is InternetExplorerDriver) { driver.FindElement(elementToClick).Click(); }
  • 18. Statement • I want to be able to delete all the cookies so my browser has a clean session before running the test Sample Problem • IE cannot manipulate httpOnly cookies Internet Explorer Driver.Manage().Cookies.DeleteAllCookies();
  • 19. Workaround • When instantiating the InternetExplorerDriver we can set options to ensure that the session is cleared • Note that his means you have to start a new browser for each test Internet Explorer var opts = new InternetExplorerOptions { EnsureCleanSession = true }; Driver = new InternetExplorerDriver(opts);
  • 20. Statement • I want to write my automation once so I don’t have to have special code paths for different device views Sample Problem • A responsive view might have multiple elements with the same locator value and your FindElement() might not get the one you want Responsive Design Driver.FindElement(By.Id("loginButton"));
  • 21. Workaround • Use the same locator value for all the designs • From the test make sure your FindElement searches for Displayed == true elements only • Add special helper variables to help determine if you are in mobile, tablet, or desktop view • Limit use of these though as it could increase test maintenance work Responsive Design Driver.FindElements(By.Id("loginButton")).First(e => e.Displayed);
  • 22. Statement • I am running tests remotely and want screenshots during test run for debugging Problem • Screenshots can increase test run time. Some devices/browsers more than others • IE takes a full webpage by taking multiple screenshots and combining them • Android/iOS devices are slow when taking screenshots Screenshots
  • 23. Workaround • Only take screenshots on failed steps • Have a way to easily toggle screenshots on or off Screenshots
  • 24. • Each browser has its own quirks • Be flexible in your automation design • Limit the amount of browser specific code Summary