Since Selenium IDE is unmaintained, how to write Selenium tests quickly?

139 Views Asked by At

Selenium IDE is a very useful tool to create Selenium tests quickly. Sadly, it has been unmaintained for a long time and now not compatible with new Firefox versions.

Here is my work routine to create Selenium test without Selenium IDE:

  1. Open the Inspector

  2. Find and right click on the element

  3. Select Copy CSS Selector

  4. Paste to IDE/Code editor

  5. Type some code

  6. Back to step 2

That is a lot of manual work, switching back and for. How can I write Selenium tests faster?

3

There are 3 best solutions below

0
On

I'm not sure what type of framework you're using, however any framework build using Page Object Model requires to create page objects consisting of WebElements. There we've to specify robust relative xpath and css selectors.

In the steps give above I'd consider adding one more step:

  1. Open the Firebug + Firepath
  2. Inspect the element
  3. Update the suggested css or xpath to make it robust(This step shouldn't be ignore for the sake of robust tests)
  4. Paste to IDE/Code editor
  5. Type some code Back to step 2

You can also make use of some utilities given below for page object generation, however, I've never used them:

https://chrome.google.com/webstore/detail/selenium-page-object-gene/epgmnmcjdhapiojbohkkemlfkegmbebb

https://unmesh.me/2013/08/29/pageobject-generator-utility-for-selenium-webdriver/

0
On

How about using this free tool? https://www.katalon.com It seems to have record and playback feature as well.

0
On

The best way is to learn how your app is constructed, and to work with the developers to add an id element and/or distinctive names and classes to the items you need to interact with. With that, you aren't dependent on using the fragile xpaths and css paths that the inspector returns and instead can create short, concise expressions that will hold up even when the underlying structure of the page changes.