Saturday, April 4, 2015

Opening Browser and Customizing:

Before we want do any actions in the web page we have open the browser ,that may be any browser
here is some useful tips to open the browser:

WebDriver is An Interface, which has only the public and abstract methods 

SO we can't create object to the WebDriver Interface just we will create a reference variable and point to the object of any class.Such that we can use same abstract methods in the interface we can use with different implementation

EX:Interfaces

WebDriver,
JavascriptExecutor,
 SearchContext, 
TakesScreenshot,
 FindsByClassName, 
FindsByCssSelector,
 FindsById,
 FindsByLinkText,
 FindsByName,
 FindsByTagName, 
FindsByXPath.



WebDriver driver;

1.Opening Firefox browser

WebDriver driver=new FirefoxDriver();

2.Opening Chrome Browser:

System.setProperty("webdriver.chrome.driver", "path of the Chrome driver in your system");
 driver = new ChromeDriver(); 



3.Opening IE browser

System.setProperty("webdriver.ie.driver", "path of the IE driver in your system");
            driver = new InternetExplorerDriver();



Customizing:

 WebDriver driver;
1.New Size
driver.manage().window().setSize(new Dimension(int number, int number));
2.Position of the Window
  driver.manage().window().setPosition(new Point(int x, int y));
3.Maximize The Window
driver.manage().window().maximize();
 








 


   

 

No comments:

Post a Comment