Tuesday, 8 April 2014

How to Start Selenium WebDriver

What is selenium.

-> born at 2005
-> Java script is main core for selenium. But its difficult to debug. SO they introdue for support many language like C#,PHP,Rupy,Phython.


Selenium RC

-> Its supports mozilla,IE,Chrome,Safari,Opera

Selenium IDE

-> only supports mozilla firefox. and provide Record and Run.
-> Its not support for dynamic web page.
-> Its selenium 1.0

GRID

-> We split whole test cases into seperate and run on different machine.
-> New version is Grid 2.0

Selenium Web Driver :

-> safari and opera is not supported.




Step 1) Download & Install Java on your Computer
Step 2) Install Eclipse on your computer
Step 3) Download Selenium Java Client Driver
Step 4) Configure Eclipse with Selenium WebDrive

Refer this link -> http://www.softwaretestingclass.com/how-to-run-your-first-selenium-webdriver-script-selenium-webdriver-tutorial/



    WebDriver driver1= new FirefoxDriver();
                UserDefindFunction obj1=new UserDefindFunction();
                driver1.get(baseUrl);
            */  
                // For Internet Explorer Browser
             
                System.setProperty("webdriver.ie.driver", "D:\\Selenium\\64 Bit\\IEDriverServer_x64_2.40.0\\IEDriverServer.exe");
                WebDriver driver1 = new InternetExplorerDriver();
                UserDefindFunction obj1=new UserDefindFunction();
                driver1.get(baseUrl);




How to develop the selenium script

-> Inall JDK,Eclipse ID and configure with Selenium
-> Download add-on for inspect the element as per the browser
-> And find the any unique value for any object in browser as per in the below preference

1) Id
2) Name
3) ClassName
4) Xpath
5) Css

-> And make sure those elements are unique by search those value by find button present in the Add ons.




Working with identify the objects in different browser

1)  Firebox Browser

-> Firebog or Xpather (Add on - need to download)
-> we can see this Add on in Tools-> Add on

2) IE Browser

-> IE Devloper Toolbar (No need to download. Available in latest version)
-> we can see this Add on in View-> Explorer bar-> IE Developer

3) Google Chrome

-> Chrome Devloper (Add on - need to download)

But we unable to find Xpath value using IE & Google Chrome Add on. So we should use Firebox Add on to find Xpath.




How to identify objects by location

-> As part of the selenium, the every object in web page treates as web Element. This concept is not like QTP. The QTP every object classified as the different classes like WebEdit,WebButton,WebCheckbox etc.


-> Below Five approach for identify objects uniquely


Id
Name
ClassName
Xpath
Css

The preference for for using above approache in codes  are from top to bottom.

-> If ID,Name,Class Name is not unique in the web page. Then only we should goto Xpath and CSS


No comments:

Post a Comment