1

We plan on using Selenium with JavaScript, so I got Selenium Webdriver with WebDriverIO. I can successfully create a js script and run it via Test Runner.

But being a Selenium noob, I also got Selenium IDE, in the hopes that I could use that just to help me get started with simple stuff and then improve / expand on the scripts that that creates. But JavaScript is not in the export options. So I found actually 2 packages that are supposed to be used for this:

selenium-html-js-converter, or selenium-ide-js-converter.

I am having trouble getting started with these. The IDE converter seems really simple / easy, except that its documentation just states

use the command

require('selenium-ide-js-converter')('html folder
name','js folder name')

But, Where? / How?? And the HTML converter just seems really complicated.

I tried searching for a tutorial or something on using either of these but to no avail. Has anyone used the IDE converter that could help me with just that one step? Or does anyone have more specific and helpful documentation on using the HTML converter, if that is what I ought to use instead?

Thank you!

  • How good are your JavaScript skills? You need to be pretty competent JS coder to be able to write maintainable tests: understand Object design, design patterns like PageObject. What other programming languages are you competent in? There are no shortcuts - the only shortcut I know is that Python is a bit easier for beginners. But even with python, will take you long time to be a competent programmer – Peter M. - stands for Monica Mar 29 '17 at 21:37
  • @PeterMasiar - does my level of competency with JavaScript affect the answer to this question? My JavaScript isn't bad...just using WebDriverIO will take some getting used to. And yes, I understand Object design and I'm actually a developer with a QA background. – Andy Mar 30 '17 at 14:12
  • If you are developer, don't waste time with Se IDE. It generates crappy code. Write your own code using PageObject design pattern - it will be MUCH easier to maintain long-term. – Peter M. - stands for Monica Mar 30 '17 at 14:36
  • Another free tip: Avoid XPath. Locate elements using, ID, name, CSS locator. – Peter M. - stands for Monica Mar 30 '17 at 14:37
  • 1
    Some thoughts since I use js (Node) as my primary automation language at the moment. The main difficulty my non-JS hires run into is understanding Promises. When using a chained library like webdriverio you won't wind up thinking about them very often. When using non-chained libraries like the selenium-webdriver npm look into async/await to make your life wildly easier. – Cherree Oct 31 '17 at 11:27
1

The Selenium IDE scripts exported to js script doesn't work seamlessly well for webdriver.io scripts.

Any recorder is having its limits. But you can use it to familarize with the webdriver.io commands you can try this recorder for initial understanding. http://seleniumbuilder.github.io/se-builder/ http://seleniumbuilder.github.io/se-builder/tools.html

0

While there are tools that will convert IDE tests to Webdriver tests, it's generally not a good idea to do so. The code these tests generate is terrible: it's hard to read, very fragile and overly complex.

The better option is to either use a framework that will take care of a lot of the work for you (like for instance Robot Framework) or to simply learn one of the multitude of programming languages that Selenium Webdriver supports.

I personally would advise doing both of these. A framework will help you put some basic tests into place quickly, but eventually you'll run into problems that are specific to your needs and you'll have to dive into custom code anyways. In some companies the developers will take on that task and write the custom code that you need for your tests, but as a tester I like to have full control over my tests so that I know their quality and in turn know how well I am assessing the quality of the thing I am testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.