Question

I have been using WatiN for some browser automation and website testing. Recently I received a request to automate some task that needs to check a partner website for existence of some SKU (since they don't have a proper API) and confirm transaction.

I tried using WatiN, but since this runs on a server and on-demand, the server desktop is naturally locked at most times and the IE window does not open and the process is never run.

I am looking for an alternative to WatiN, which is preferably a .net library (not a must, but just makes things easier), does not require a logged in user and being free and open source is always nice.

Anyone have experience with this type of automation?

Was it helpful?

Solution

You can use the Selenium WebDriver coupled with PhantomJS.

Selenium is similar in many ways to WaitN but it supports more browsers. PhantomJS is a headless browser and wrapped in a portable executable you can run from your web server.

Once you've added the NuGet packages, you will be able to instantiate a PhantomJS web driver and control a site without having to launch a full-fledged browser.

var driver = OpenQA.Selenium.PhantomJS.PhantomJSDriver();

We use this on build servers since the build agents are not logged in and won't be able to launch a normal browser process.

If you just need to check some HTML, you can use WebClient to make a request to the site, return the content response as a string and parse it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top