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

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