1

Recently my team has been implementing Windows API into our framework and moving away from Selenium. So far I have found many benefits to functional browser testing with Windows API over Selenium. The most significant benefit is the ease of debugging without using a Selenium Driver instance.

Writing unit tests for specific functionality with our WAPI framework is much easier and quicker than using Selenium. If I am debugging with Selenium and reach an error I have to recreate an instance of the driver, reload the page, and navigate back to the specific web page to continue testing my code.

I have two questions. The first is, am I going about debugging in Selenium the wrong way and is there an easier way to do it? My second question is, has anyone else noticed this and if so why continue to use Selenium?

5
  • You will need to re-write all of your existing Selenium tests using Windows API, is that a price your company is willing to pay?
    – Yu Zhang
    Jan 6, 2017 at 22:17
  • 1
    Luckily we have started constructing the framework. Our initial intention was to try and construct a framework that was as agnostic as possible. So right now making the change from selenium is not too painful. Jan 6, 2017 at 22:42
  • > implementing Windows API .... can you explain a bit more how this works? Is this a self-made testing framework?
    – timfredo
    Jan 7, 2017 at 9:34
  • We are interacting with the window natively in the OS, finding the elements in the tree, and then interacting with them based on their available functionality. Unfortunately I can't give a lower level explanation as I am not implement this part of our framework. Yes, this is a self-made framework. Jan 8, 2017 at 21:38
  • Sounds good that you are at initial stage where taking any sharp turn will be easy for you. But that freedom has increased your responsibility friend. You really need to figure out what all are your requirements and how those can be achieve? Pls dont count only few, If working well then and then only choose any framework. Keep updating senior members that which framework your are analyzing & what level can be achieve in terms of implementation + modification + maintenance point of view.. All the best ! Jan 9, 2017 at 4:03

2 Answers 2

1

The first is, am I going about debugging in Selenium the wrong way and is there an easier way to do it?

I assume you're using unittest or some other Python test framework. For debugging purposes, a mature test framework provides a way to run a single test in isolation even when the same Python class defines multiple tests. If you can't do that now, consider changing things so that you can run a single test in isolation.

My second question is, has anyone else noticed this and if so why continue to use Selenium?

If you're sold on automating your browser UI tests, Selenium is at least as good as anything else. It has a large user community and it's open source, which means if you run into a problem, you are more likely to find a solution than if you use a proprietary framework or a framework with a small user community.

There is a distinction between (1) using Selenium to test your UI and (2) using Selenium to test your business logic through your UI. The distinction is fuzzy, but if you don't have a way to test your business logic at the API level, it is tempting to do #2.

It is suboptimal to have extra layers between your tests and what you're trying to test. If you have a programatic API, you should write tests using that API. That doesn't mean you should throw away your Selenium tests, but it does mean you should use Selenium for testing things that can't be tested at the API level, i.e. for testing the UI itself.

3
  • We are using c# and VS UnitTest (for now). The problem isn't being able to run a single test, but running a section in the middle of the test. If I want to test step four, I have to start selenium and either navigate to that portion of the test manually or let the framework do this. If I'm testing my code through the windows API I only need the browser open. I can run my unit test multiple times with no need for selenium to be running.</br> Isn't Selenium an extra layer between my tests? So as long as I can test everything at the API level, wouldn't doing away with selenium be best? Jan 9, 2017 at 21:41
  • If you don't need to test your UI, you should not use Selenium.
    – user246
    Jan 10, 2017 at 0:29
  • I am testing a UI. I am talking about testing the code that tests the UI. Jan 10, 2017 at 15:55
0

why continue to use Selenium?

Because Selenium is the W3C standard way to interact with the browsers (browser automation) across platforms and browser providers.

I found that Selenium + Python, with it's ability to drop to interactive Python debugger and investigate Selenium objects as it is in real time, is fast, productive and pleasure to work with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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