Tuesday, 31 October 2017

Run Selenium Grid On Internet Explorer Browser

Exported from Notepad++
package com.seleniumGrid; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class RunSeleniumGridOnIE { WebDriver driver; String nodeUrl = "http://192.168.3.12:5555/wd/hub"; @BeforeClass public void setUp() { try { DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_
IGNORING_SECURITY_DOMAINS
, true); driver = new RemoteWebDriver(new URL(nodeUrl), capabilities); } catch (MalformedURLException e) { e.printStackTrace(); } } @Test public void testSeleniumGridOnIE() { try { driver.manage().deleteAllCookies(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES); driver.get("https://seleniumcodeexample.blogspot.in"); System.out.println("Title Name is : " + driver.getTitle()); } catch (Exception e) { e.printStackTrace(); } } @AfterClass public void tearDown() throws InterruptedException { Thread.sleep(2000); driver.quit(); } }

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...