Running Tests Headless with PhantomJS

PhantomJS is a headless web driver which will enable you to execute your Selenium tests without having to spin up a driver, this can improve the speed of your tests and use less resources. Commonly it is used in your CI builds when running acceptance tests. It’s easy to implement and get up and running with lets get a copy […]

JavaScript Injection with Selenium

A useful trick we can deploy is injecting JavaScript to manipulate the browser or change values without specifying user interactions. Let’s see how: internal void CloseActiveTab() { IJavaScriptExecutor js = Context.Driver as IJavaScriptExecutor; js.ExecuteScript("window.close();"); } This code is closing the active tab displayed. By Newing up the IJavaScriptExecutor interface, we can effectively send JavaScript commands directly to the browser console. […]

Manipulating JavaScript Alerts with Selenium

If your application under test generates JavaScript alerts or dialogues how can we interact with these using Selenium rather than look elsewhere such as AutoIt? Luckily we can manipulate these dialogues with Selenium to either accept (click Ok) or dismiss (click Cancel) the pop up allowing your test(s) to continue. You can also get the text of an alert if […]

Gallio Test Runner

Gallio (sometimes known as MB Unit or Gallio Icarus) is a test runner which to me has two distinct advantages over MsTest and NUnit. Parallel test execution support and built in test reports, although NUnit does have parallel support with PNUnit. How to set it up Download and install Gallio from here. In your Visual Studio Project navigate to Project […]

Selenium Builder Actions

There are some complex actions which may not be obvious how to do in Selenium but by leveraging the use of the builder actions we can add more user interactions into our scripts where needed. using OpenQA.Selenium.Interactions; So what can we do with this? Lets have a quick look at what is contained within and then have a look at an […]