Saturday, May 10, 2014

Part 0 Troubleshooting WebDriver issues are easy and so can you!

Seriously troubleshooting issues in WebDriver is easy, if you know what you're doing. Knowing what you're doing isn't easy; it requires a lot of learning and practice. I’m going to attempt to outline some basic steps to troubleshoot some common issues people encounter when using WebDriver.

At this point I'm planning to make 4 blogs on troubleshooting, in the first blog I want to make sure everyone understands at a high level of how the major components interact. The rest of the blogs will show common issues and how to troubleshoot the possible causes.

First, you need to understand that web sites and web browsers are built to give the user the illusion of full synchronized applications. What’s really happening? The “Server” is hosting a “Web Site”. The “Server” serves the “web Site” to a “Client”. The “Client” aka “Browser” renders that “Web Site”.  The communication between the “Client” and “Server” is over a stateless protocol called HTTP. This will be the cause of much confusion when you're working in UI Automation so a good understanding is required if you want to be proficient. Look if you don't understand this, you should before you move on!

Second, you need to understand the fact that WebDriver is an API that allows you to interact with the browser (remember the browser is just one side of that illusion of synchronization). As you might guess when you develop with an API that interacts with an illusion you're likely to have some issues. A good portion of the time when you have a tough issue it’s related to the connection of the following items:

  • Developer uses Tests & Code to interact with WebDriver
  • WebDriver uses native calls interact with Browser
  • Browser uses HTTP interact with Web Site

I have notice Developers who are learning or lazy can be quick to place blame WebDrivers interaction with the browser. More often than not I find the issues to be the test code or the web site code, but if you find a “real” issue with WebDriver, good on you… File a defect with Selenium WebDriver and give yourself a gold star.

Third, you need to keep learning and experimenting.

Last, you need to be able to model these interactions and concepts in your head when come across real tough problems because troubleshooting tough software issues is more than check 1, 2, 3, done. Troubleshooting tough software issues is problem solving and understanding complicated interactions when they have unexpected results, and that ain't easy. People don't naturally consider all possible outcomes of an action, especially if that outcome is unlikely. So when learning a thing it's good to understand it as a whole and just as it applies to your happy path.

Links to Troubleshooting:
Part 0 Troubleshooting WebDriver issues are easy and so can you!
Part 1 Troubleshooting WebDriver NoSuchElementException
Part 2 Troubleshooting WebDriver StaleElementReferenceException
Part 3 Troubleshooting WebDriver ElementNotVisibleException

Other possible exceptions WebDriverTimeoutException, UnhandledAlertException, WebDriverException, InvalidOperationException

Post a Comment