Friday, February 26, 2016

Let's Start The Test automation with SELENIUM -Part 4


WebDriver Commands

IWebDriver Browser Commands in C#




create a driver object from IWebDriver and press dot key. This will list down all the methods of IWebDriver.

IwebDriver driver = new FirefoxDriver();
 
diver.
Following image display the all command we can use with IWebDriver











I am gonna explain one by one with examples which are most use


01-Url Command



string IWebDriver.Url { get; set;} - This method Load a new web page in the current browser window. This method get and set the value and can be used both ways.

Command - driver.Url = “url”;  //To open the Url


Command - String Url = driver.Url;  // To get the opened Url

Where url is the website address to load. It is best to use a fully qualified URL.

Example:












02-Title Command


string IWebDriver.Title{ get;} - This method fetches the Title of the current page. Accepts nothing as a parameter and returns a String value.

Command – driver.Title;

As the return type is String value, the output must be stored in String object/variable.

Example:


Following example for How we can use this command



03-Page Source Command




string IWebDriver.PageSource{ get;} – This method returns the Source Code of the page. Accepts nothing as a parameter and returns a String value.
Command – driver.PageSource;
As the return type is String value, the output must be stored in String object/variable.
Example:




04-Close Command 

void IWebDriver.Close() – This method Close only the current window the IWebDriver is currently controlling. Accepts nothing as a parameter and returns nothing.

Command – driver.Close();

Quit the browser if it’s the last window currently open.

Example:
 

 05-Quit Command

void IWebDriver.Quit()  – This method Closes all windows opened by the IWebDriver. Accepts nothing as a parameter and returns nothing.

Command – driver.Quit();

Close every associated window.
Example:



Google.com Url navigation example code



 output  -
This is not whole Out put You can try and see it your self ,Try it :)




MS VISUAL STUDIO CODEDUI TEST FRAMEWORK AND TEST EXECUTION

MS VISUAL STUDIO CODEDUI TEST FRAMEWORK AND TEST EXECUTION  1.0 Pre-Requisites for the execution 1.1 Software Requirements ...