Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Making cross browser tests beautiful

308 views

Published on

How many times have your Selenium test suites run beautifully on one browser, only to fail when run in any other browser? This is an extremely common problem faced when incorporating cross-browser tests into your test runs. Not all browser drivers are created equally, but that doesn’t mean you can’t create a robust suite of cross-browser tests.

This presentation shares strategies for making cross-browser tests invincible. It focuses on topics such as using as choosing the best locators for all browsers, explicit vs. implicit waits and how to leverage cloud-based testing tools.

This presentation was given at SeleniumConf London in November 2016.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Making cross browser tests beautiful

  1. 1. Making Cross-Browser Tests Beautiful
  2. 2. Outline ● Why ● How ● Case Study ● Problems ● Solutions ● Lessons Learned
  3. 3. What do you expect to get out of this session?
  4. 4. Why ● Gives confidence the application works the same in all browsers ● Can easily test changes in browsers ● Saves time from manually testing all features
  5. 5. How ● Answer the following questions: ○ Which browsers will be supported? ○ What is the most important workflow test? ○ How will the tests be run?
  6. 6. TASK: Build automated tests for a student loan refinance application
  7. 7. PROBLEM: Don’t know how application works in other browsers
  8. 8. SOLUTION: Implement automated cross-browser tests
  9. 9. Step 1: Decide supported browsers
  10. 10. Step 2: Decide what will be automated ● Determine what is the most critical workflow to test
  11. 11. Step 3: Decide how to run tests ● Run tests in CI ● Need access to all supported browsers ● Consider cloud testing tools
  12. 12. Step 4: Write tests!
  13. 13. It should be as easy as changing the driver, right?
  14. 14. Problem 1: Page Elements
  15. 15. On page elements ● Dropdowns, radio buttons and checkboxes are tricky ● Use the same locator for all browsers ● Stick to CSS when possible
  16. 16. Element is not clickable
  17. 17. Problem 2: Timing Issues
  18. 18. On timing issues... ● Some drivers are faster than others ● Discrepancies between physical and virtual machines ● Need to wait for elements
  19. 19. Implicit Waits ● Set for the entire duration of the webDriver object ● Tells WebDriver to wait for X units of time
  20. 20. Explicit Waits ● Confined to a particular web element ● Tells WebDriver to wait for the element up until X units of time
  21. 21. Problem 3: Driver Capabilities
  22. 22. Drivers are not created equally ● Drivers are managed by different individuals ● Native capabilities differ ● Same functionality isn’t always available
  23. 23. File Upload
  24. 24. The Safari Driver is implemented in JS and does not have the privileges necessary to manipulate an <input type = “file”> element. Therefore, the SafariDriver does not support file uploads.
  25. 25. Resolution
  26. 26. ● Maximize browser window ● Set a specific resolution at run-time ● Scroll an element into view
  27. 27. Soon, the Cross-Browser Tests were complete!
  28. 28. Lessons Learned...
  29. 29. Start testing early.
  30. 30. Automate one feature first.
  31. 31. Run tests in CI regularly.
  32. 32. Questions? LinkedIn: meaghan-lewis Twitter: @iammeaghanlewis Email: meaghan@lever.co

×