Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Thursday, December 27, 2012

NTLM authentication aka Windows Authentication - JMeter

Recently was given an application with Windows Authentication that i had to create performance test scripts using JMeter as a tool.

Microsoft CRM Dynamics in itself is a complex system adding lengthy scenarios for performance testing would make it worse if you can't quickly get going recording, Hence i went ahead recording the scipts

Follow the usual steps of setting up Proxy Server & Overriding any group policy set :

1. Create a New Test Plan

2. Right Click on WorkBench Click on Non Test Elements >HTTP Proxy Elements Just like shown below

3. Enter all details you would like to have refer to my other post on how to exclude or include a specific URL patterns

If you have strict network settings just like ours where you can't chnage your local network settings

4. Change the Group Policy The local Group Policy object on gpedit.msc /gpcomputer:" ". Go to run command type in gpedit.msc enter . A group policy window will open up & navigate all the way upto local settings

5. Check the option for Enable Proxy Settings.

6. Now access regedit from the run command. Windows > Internet Settings > Proxy Server - Enter localhost:8080

7. Now Click on ProxyEnable 1 like the two options shown

8. Now that we have all we need to start recording over firewall.

9. So we have a Test plan with a Thread Group,HTTP Proxy Server being added to it all you now need to do is click on start

10. You'll see all your actions recorded as a child to the Thread group.

Now let's not forget we did all the above to capture actions of an application that needs a Windows Authentication. So when you playback

11. Make sure you add a HTTP Authorization Manager to each of your transaction.

12. Enter the Server name,Domain,Username,Password just like shown ins creen shot

Hope these steps help in recording Windows Based Applications and reinventing the wheel again save time
Check google pagerank for automationwithselenium.blogspot.com

Tuesday, October 23, 2012

WebDriver C# Implicit & Explicit Wait

Earlier versions of Selenium most of us ended up using Thread.Sleep()

To wait for objects to render the page fully so that we can access the object from the DOM else Selenium would fail with errors for No such Element

Here is an example of how to use implicit wait using WebDriver FindElement

Code snippet for a single element

Code snippet for multiple elements

Most of the webpages have jQueries running some take longer to load,If a page doesn't load in 60 seconds then it is never going to load

here is the code snippet

However,You will have to ask your developers to set a flag within Javascript that says that the jquery is loaded.

public bool IsPageLoaded(IWebDriver driver)




//First wait for the browser to register the new URL;

if (driver.Url.Equals(OldUrl, StringComparison.OrdinalIgnoreCase))


return false;


log.Debug("Waiting for Page to load. Current URL: " + driver.Url);

//Second wait for JQuery to become available.

if (IsCheapflightsPage)


IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;

return (bool)executor.ExecuteScript("return CF.isReady;");


return true;


catch (InvalidElementStateException)


log.Error("Caught InvalidElementStateException. Assume page not yet loaded and continute waiting.");

return false;


automationwithselenium.blogspot.com-Google pagerank and Worth

WebDriver C#,using log4net - logging

Most of us want our logs to be written to a file externally.

Whether they are application logs,console logs.

In our case have used to grab the logs for the WebDriver C# bindings using the log4net.dll's

Below are step by step instructions as to go about using log4net :

1. Add a config section in the app.config file under configuration

2. Add a appSettings section where you define a key value pair

Which would facilitate ConfigurationManager to get the value

3. I have created a config file other than that of the app.config & named it as log4net.config - below is the configuration

Have used RollingFileAppender and specified a location where these logs are to be written.

RollingFileAppender - This is just like LogFileAppender with an exception doesn't create a new file

Until it has reached the MaximumFilesize that we have configured initially

4. The below code snippet shows how we need to initialize the logger

private static readonly ILog log = LogManager.GetLogger(typeof());

5. Now accessing the key value pair from the app.config file

log4net.Config.XmlConfigurator.Configure(new FileInfo(ConfigurationManager.AppSettings["log4netConfig"]));
automationwithselenium.blogspot.com-Google pagerank and Worth

Thursday, August 16, 2012

Setting up WebDriver for C# bindings with VS2010 ,NuGet , NUnit , TFS

With changing need & moving onto different businesses/work place.

We are thrown different challenges !!!! mine was get the framework done in C#

As the technology stack was .Net/IIS servers.

Here's a step by step illustration of Integrating Visual Studio 2010 with NuGet, webDriver C# bindings ,Team Foundation Server

Pre-requisites :

1. I have a licensed Visual Studio 2010 installed on my box,if you don't you can live with a trial version too

2. Now adding NuGet to Visual Studio 2010

A bit about NuGet : Yeah it’s NuGet & not Nugget  to all those nugget fans
NuGet is a Visual Studio that makes it easy to install and update third party
libraries(In our case it is webDriver API’s) and tools in Visual Studio.

3. VS 2010 > Click on Tools > Extension Manager

a. As shown in the screen shot as you don’t have NuGet already installed you should see DOWNLOAD against the NuGet Package Manager

b. I have NuGet on my box so a little green icon.

We are now done with adding NuGet Package Manager

Pre-requisite : TFS access if you are using Team Foundation Server as your version control get your Login details from whoever manages it

1.Start your Visual Studio 2010 on start you should your screen just like the one one displayed in screen shot

a.Click on servers and add your TFS server

b.Assuming that you have already identified location to check-in your code select that directory

d.Click on Connect

2. On click to connect a pop-up opens up

a.Enter the TFS server name /url just as shown in the screen shot

3. Now to we have gained access to TFS & integrated with VS 2010 we have to create a local folder that maps to the folder in TFS

4. Either select the default Workspace or create a new one. while you are on a Source Control Explorer view- like shown in the screen shot

5. On selecting one of the workspaces you'l see a popup just as shown in the screen shot

6.Now Click on Add & enter all details required as shown in screen shot

7.We are nearly there Switch to Source Control Explorer and get the latest version

8.Let's verify if a local sync was actually through just like the one displayed in screen shot

9.Add a file called packages.config look at the screen shot

10.For getting latest updates for any of your third party tool set.

Use NuGet - go to Extension manager & click on updates you'l be able to see them click on update you are all done.
automationwithselenium.blogspot.com-Google pagerank and Worth

Wednesday, May 23, 2012

Invoking a InternetExplorer using InternetExplorerDriver

It is been a struggle to get the InternetExplorer work with different drivers available specifically for each browser.

Life would be easy at work when we move finally to Selenium Grid.

Steps to get the internet explorer driver work :)

1. Download the internet explorer driver from seleniums

2. Add the below snippet for Invoking the InternetExplorer Driver

3. Have a look at this bug that was raised for issues with InternetExplorerDriver http://code.google.com/p/selenium/issues/detail?id=1795

If you hit any of the issues, However the below solution works perfectly fine.

var options = new InternetExplorerOptions();

options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

IWebDriver driver = new InternetExplorerDriver(options);

Thought of Adding this bit here with New release of IE standalone server Selenium WebDriver 2.22

Reason for having a standalone server

" The IE WebDriver now has a standalone server. Previously, we've relied on packaging and silently using our own DLL, but this often meant that Selenium was falling foul of overly active virus scanners. If you place the new IEDriverServer.exe on your %PATH% the InternetExplorerDriver will Do The Right Thing and use it. For now, the DLL is also still packaged just as it always was, and you can use it by setting the DesiredCapability "useLegacyInternalServer" to the boolean "true" value when creating your IE instance."

Now a bit more steps to follow/get IE working

1. Download the latest IE standalone server based on your requirement of 32 bit or 64 bit

Download from here : http://code.google.com/p/selenium/downloads/list

I have downloaded InternetExplorerDriver standalone server for 64-bit IE

2. Unzip it to a location where all other .dll files are present

3. You can either set a path to locate IEstandaloneserver or call within your script the executable

This is how you will call within the script.

Updates that are needed for our code to invoke is as follows

var options = new InternetExplorerOptions();

options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;

IWebDriver driver = new InternetExplorerDriver(@"C:\Selenium\",options);

automationwithselenium.blogspot.com-Google pagerank and Worth

Wednesday, May 2, 2012

Invoking a Chrome browser - using ChromeDriver

As ChromeDriver is developed is Collaboration with the Chromium team.

Implementation is slightly different, Thought i'll better have it blogged which may help any one

Here are steps i followed to override the Enable Protected Mode To All zones

1. Here's the detailed wiki of selenium for a bit of background http://code.google.com/p/selenium/wiki/ChromeDriver

2. Download a appropriate driver based on your Operating System http://code.google.com/p/chromedriver/downloads/list

There are many ways mentioned on the selenium website for invoking the ChromeDriver.exe,I am mentioning what worked for me

IWebDriver driver = new ChromeDriver(@"C:\Selenium\");

driver.Navigate().GoToUrl("Pass your http request");

3. The above snippet is C#

4. On executing your tests

5. Just like in screen shot you'l see the chromedriver.exe being initialized

6. Then the browser launches

7. You will have to cleanUp at the end of your test by quitting the driver

automationwithselenium.blogspot.com-Google pagerank and Worth

Thursday, April 19, 2012

Generating HTML report for NUnit with Nant

In my earlier post we saw how we can get the NUnit runner with our Visual Studio 2010 ultimate.

Now let's look at how to generate reports in html format.

Steps invloved in generating a html report for nunit tests :

1. Download Nunit2report from http://sourceforge.net/projects/nunit2report/ and unzip it to a location just like in the screen shot

2. Download Nant from http://nant.sourceforge.net/ if you don't have already place it in a location suitable to you

3. Once you are in Nunit2Report bin directory - You must have these files just like i have in screen shot

4. Copy all files from the bin directory of Nunit2Report to Nant/bin directory - Just as in screen shot

5. Add reference to Nant with Visual Studio 2010

6. Click on Tools Menu in Visual Studio and click on External Tools - Just like in Screen shot

7. Add details just like i have entered in the external tools configuration for nant

8. You can either follow step 7 for integrating Nant with Visual studio or just create a batch file with details $NANT_HOME\bin\nant.exe -buildfile

9. Let's look at how our build file looks - Have a look at the screen shot

10. You should see a nice html report - Just like screen shot

11. We can add a task to email results as well using the mail task
automationwithselenium.blogspot.com-Google pagerank and Worth

Monday, April 16, 2012

Integrate Nunit With Visual Studio 2010 Ultimate IDE

How to Integrate Nunit with Visual Studio :

1. Download Nunit from http://nunit.org/?p=download

2. I have Visual Studio Ultimate 2010 IDE have tried only with this not sure if it works well with other versions former or later.

3. Go To Tools Menu >> External Tools.

3.a It would look like this

4. Click on Add - Enter Details as specified based on your system settings - Have a look at the picture

4.a Click on Apply & then OK

5. Click on Customize - Check Against Nunit and then close

5.a Have a look at the picture

6. You should be able to see Nunit within your Tools Menu

7. Click on Tools > Nunit - You will see GUI open up

7.a Just like the one in the screen shot

automationwithselenium.blogspot.com-Google pagerank and Worth

Tuesday, April 10, 2012

Getting started with WebDriver C# & Visual studio

With new changes in work environment & Agility comes change in technology & moving on from your usual traits

To explore & challenge yourself with new paths.. Ahh am going to philosophical :)

Let's get started with WebDriver C# - It took a while for me to move from jars to dll's, API's to

Assemblies,Packages to namespace ...But must say have gone past the initial hiccups..

It looks all well now, Hence blogging my experiences :) as i could hardly find any help on C#.

List of Things to do before plunging in :

1. Download webDriver for .NET from http://code.google.com/p/selenium/downloads/list

2. We have licensed Visual studio ultimate 2010 as IDE,If you don't have one you can download Visual studio Express

3. You can either write in NUnit framework or in Microsoft's Test tools in Visual studio

4. Download Nunit from here based on the operating system you are in


automationwithselenium.blogspot.com-Google pagerank and Worth

Thursday, March 8, 2012

Microsoft's SilverLight Plug-in

Microsoft's SilverLight Plug-in:
Silverlight is a powerful development that comes with Rich Internet Application ,how does it impact testing.
Challenge for a tester is object identification :
Though it is cross browser compatible it is hard to identify objects with the usual selectors
IE developer
Debug bar

Solution is :
SilverLight Spy
This is Opensource tool for identifying UI elements that are developed in SilverLight with limited features & commercial with full features.
Here is there official link : http://firstfloorsoftware.com
Screen shot -1 : Displays the Where to enter url

Screen shot -2 : Displays How to use the UI element selector
Tabs of Properties,View,Statistics(Am not sure how we are benefitted with this
automationwithselenium.blogspot.com-Google pagerank and Worth

Thursday, March 1, 2012

Writing our first script in WebDriver

Prior to getting started with writing scripts ensure that you have completed your installations & you have identified which framework you would work with

I have chosen to write the test in JUnit Framework , Where Eclipse is my IDE & Selenium 2.

Here is a basic script for search on an amazon site.

Objects that are dealt are :

1. Drop down list

2. Text box

3. Button

4. Link

Actions performed are :

1. Am selecting a value from drop down list

2. Enetering text in the text box

3. Clicking on the button.

4. Clicking the link that meets my partial text of the url's fetched

import org.junit.Test;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Search {


public void testSearch(){

WebDriver driver = new FirefoxDriver();


WebElement dropDownsearch = driver.findElement(By.id("searchDropdownBox"));

dropDownsearch.sendKeys("Electronics & Photo");


driver.findElement(By.id("twotabsearchtextbox")).sendKeys("Sat Nav & Car Electronics");


driver.findElement(By.partialLinkText("Satellite Navigation System")).click();



automationwithselenium.blogspot.com-Google pagerank and Worth

Tuesday, February 28, 2012

Getting started with Installation of WebDriver - Java Client

With SELENIUM / WebDriver being most cost effective tool for functional testing these days most of the companies are embracing this open source tool.

Let's get started with installation of WebDriver & configurations as required.

1. Download from the official website of selenium http://code.google.com/p/selenium/downloads/list

1.a Have a look at the screen shot

2. We have downloaded Selenium-2.20 version for java & selenium-server-standalone-2.20.jar was the latest when i wrote the blog

3. I am on a Windows 7 box - Create a dierctory called Selenium & have the downloaded selenium extracted. I have mine within Eclipse as i would use that as my IDE ,placed it within Eclipse for it would be easy mapping the library files a.k.a jars

This is how it would look ,folder structure & files.

Now that we have our Selenium 2 downloaded we need to have java on our box let's get that.

4. Download java from http://www.oracle.com/technetwork/java/javase/downloads/index.html

5. After you are done with installation of java to verify just go to where it is installed & check for version of java

6. Have a look at the screen shot

7. Now that we have jdk , selenium we need an IDE which is Eclipse in our case

8. Download Eclipse from there official website http://www.eclipse.org/downloads/

9. We are all set with downloads that are required to get started,Let's get to configuring as appropriate

10. Click on the eclipse.exe

11. Create a Java Project : Click on File > new > Java Project

12. Give a name to the Project as appropriate

12. Right Click on the Project name within the Project explorer window & click on Properties >> Click on Java Build Path

13. Look at the screen shot.

Screen shot 13

14. Click on Add external jars , now add the selenium-java-2.20.0.jar that we downloaded earlier

15. Again Click on Add External jars,now add the lib folder of C:\selenium-2.20.0\libs

Once you have added all your jar's it shoudl look like above screen shot 13 at step 13

16. Let's also add JUnit jar's as our framework is written in JUnit

17. Click on Java Build Path > Add Library > Will show a list of libraries just like the below screen shot

screen shot 17

Choose appropriate JUnit version

We are now done with our installations and configurations required for selenium-2,junit,java,eclipse
automationwithselenium.blogspot.com-Google pagerank and Worth