To Demonstrate use of Interfaces and Inheritance in Selenium FW
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 /** Author:Akash Tyagi* Detail: To Demonstrate Use of Interfaces and Inheritance in Selenium FW**/namespace selenium_root{//Interface with all the Possible Eventsinterface IUIEvents{void click(IWebElement obj);void sendKeys(IWebElement obj, string textToBeSet);void selectList(IWebElement obj);string getText(IWebElement obj);void getAttributeValue(IWebElement obj);void rightMouseClick(IWebElement obj, int iX, int iY);void moveMouse(IWebElement obj, int iX, int iY);void dragAndDrop(IWebElement obj, int iX, int iY);}//UIEvents Class contains all the all the event based methods//Implements Interface: IUIEventsclass UIEvents : IUIEvents{public void click(IWebElement obj) { /*Definition Yet to be Written*/}public void sendKeys(IWebElement obj, string textToBeSet) { /*Definition Yet to be Written*/}public void selectList(IWebElement obj) { /*Definition Yet to be Written*/}public string getText(IWebElement obj) { /*Definition Yet to be Written*/ return ""; }public void getAttributeValue(IWebElement obj) { /*Definition Yet to be Written*/}public void rightMouseClick(IWebElement obj, int iX, int iY) { /*Definition Yet to be Written*/}public void moveMouse(IWebElement obj, int iX, int iY) { /*Definition Yet to be Written*/}public void dragAndDrop(IWebElement obj, int iX, int iY) { /*Definition Yet to be Written*/}}//Nested Class with Parent Class as UIControls containing all the Control Based Methods//Control Based methods implements UIEvents Classesclass UIControls{class UITable : UIEvents{public string getTableText(IWebElement obj){return getText(obj);}public void getTableCellTextInRowAndClm(IWebElement obj, int iRow, int iClm){//code to written}public void getTableRowWithCellTextAs(IWebElement obj) { /*Definition Yet to be Written*/ }public List<IWebElement> getTableCellElementsInRowAndClm(IWebElement objTable, int iRow, int iClm) { return null; }}class UIList : UIEvents{public void selectListByValue(IWebElement obj, string sValue){}public void selectListByIndex(IWebElement obj, string sValue){//code to written}public string getListText(IWebElement obj){return getText(obj);}}class UILink : UIEvents{public void clickLink(IWebElement obj){click(obj);}}//end classclass UITextBox : UIEvents{public void clickTextBox(IWebElement obj){click(obj);}public void setValueInTextBox(IWebElement obj, string textToBeSet){sendKeys(obj, textToBeSet);}}//end class}}//end name space