Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

1. Is converting my Selenium IDE script to a programming language to start using webdriver sufficient?

You may get some value out of exporting your existing IDE tests, but they will likely require a good amount of clean-up. You're likely to get more value out of identifying a few pieces of core functionality in the application you're testing, and writing new tests for this functionality in a programming language from scratch.

2. ­Can you please show some examples of a Selenium test report?

Here are two examples:

3. ­I would like to see strategies for getting tests to work in multiple browers. For example, if my test works in Chrome but not Firefox, what do I do?

There are two things you're likely to run into ­when running your tests across multiple browsers: speed of execution, and locator limitations.

Speed of execution issues occur when things execute too quickly (which indicates that you need to add explicit waits to your test code) or timeout (which indicates that the explicit waits you have are too tight and need to be loosened). The best approach to take is an iterative one. Run your tests and find the failures. Take each failed test, adjust your code as needed, and run it against the browsers you care about. Repeat until everything's green.

In older browsers (e.g., Internet Explorer 8) you'll be limited by the locators you can use (e.g., CSS3 nth locators like nth-child, nth-of-type, etc) and likely run into issues with some dynamic functionality (e.g., hovers). In cases like this, it's simple enough to find an alternative set of locators to use that are specific to this browser and update your test to use them only when this browser is being used.

4. ­How can I specify to Sauce Labs to run 1 test on multiple browsers?

You can see an example of one way to accomplish it in these write-ups:

5. ­Is Selenium Grid still relevant/useful for parallelization? ­

Selenium Grid is a great option for scaling your test infrastructure if you're okay with handling the overhead of spinning up/maintaining a bunch of machines. It, by itself, will not give you parallelization. That is to say, it can handle however many connections you throw at it, but you will still need to find a way to execute your tests in parallel. You can learn more about Selenium Grid on its project main page.

6. Since each test you showed performs its own setup and teardown, is random execution order really necessary?

Yes. Random execution order is necessary to help identify (and prevent) cross-test dependencies. It also has the added benefit of exercisizing the application under test in a random order.

7. ­If I want to test load using Selenium, will I have to run the same test multiple times in one "script" or can I instruct Selenium to run it multiple times?

While you could use Selenium to test load, it's not the best tool for the job since it's pretty expensive to achieve this outcome. There are better tools suited for the job -- like JMeter or Gattling. That being said, there are some companies that specialize in Selenium-based load testing. You can find some of them on the 'Commercial Support' section of the Selenium HQ Support page.

Alternatively, you could try a more home grown approach like I outline in this write-up.

8. What's the best way to handle StaleElementReferenceExceptions? Is this ok just to squelch them?

Yes, for the most part, it's okay to rescue these exceptions. You can see an approach on how to do that here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment