WebDriver or selenium 2.0 is the most widely used tool of
selenium family. This API fit with the
same role played by Selenium RC. In
simple way can be express webdriver in following format,
Selenium 1.0 (IDE) + RC = Selenium 2.0
This has come to address to reduce limitations of RC server
and to overcome the IDE drawbacks (only support for Firefox browser). In the
long run WebDriver goal is to provide fully object oriented supporting testing
tool which will give the durable solution to many modern advanced web
application testing difficulties.
Supporting browsers
|
Firefox, Internet Explorer, Chrome, Safari, Opera, Android, iPhone (Calls
native methods of the browsers).
|
Supporting programming
languages
|
C#, Java, Ruby, Python, JavaScript
|
Supporting operating system
|
Windows, Solaris, Linux
|
Selenium 2.0
integration with Visual Studio (C#)
Setup
Environment
- Go to selenium official web site (http://www.seleniumhq.org/) .
- Click on download tab of the site to download required dlls,
- Go to “Selenium Client & WebDriver Language Bindings” section of the download page and click on download button which is in front of C#.
- If you are supposed to use different web browser than Firefox then download related driver from same download page (Firefox web browser has inbuilt selenium driver ).
- Now open visual studio and create new unit test project ,
- After loading the project add downloaded selenium dlls as references. Following dlls should be added.
- ThoughtWorks.Selenium.Core.dll
- WebDriver.dll
- WebDriver.Support.dll
- Add as web browser driver if you are not using Firefox (click on solution -> Add -> Existing Item - > select the driver exe file -> click on Add button).
First Test
Method Create to open a website
- Open the unit test c# file and add following selenium references.
- Add following code block to your test method.
- After adding above build the solution.
- After successful build, right click on test method and run the test.
Issues can
be occur,
- There can be issues to initialize webdriver if you are not using Firefox driver, then
- Go to properties of driver -> set Copy to Output Directory to Copy always.
Comments
Post a Comment