public void openBrowser(String browserType){ if(browserType.equalsIgnoreCase("Mozilla")){ driver = new FirefoxDriver(); }else if(browserType.equalsIgnoreCase("IE")){ System.setProperty("webdriver.ie.driver",System.getProperty("user.dir")+"\\driver\\IEDriver.exe"); driver = new InternetExplorerDriver(); }else if(browserType.equalsIgnoreCase("Chrome")){ System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\driver\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); driver = new ChromeDriver(); }else{ System.out.println("Please enter correct browser name"); } driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().window().maximize(); }
Tuesday, 16 September 2014
Open browser (IE, Firefox, Chrome) dynamically
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment