package com.seleniumGrid;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
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 RunSeleniumGridOnChrome {
WebDriver driver;
String nodeUrl = "http://192.168.3.12:1719/wd/hub";
@BeforeClass
public void setUp() {
try {
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.WINDOWS);
driver = new RemoteWebDriver(new URL(nodeUrl), capabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@Test
public void testSeleniumGridOnChrome() {
try {
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(35, TimeUnit.SECONDS);
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();
}
}
Subscribe to:
Post Comments (Atom)
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...
-
package com.test.automation.uiAutomation.testBase; import java.io.File; import java.io.FileInputStream; import java.io.IOException...
-
Exported from Notepad++ package com . practiceCode ; import org . openqa . selenium . WebDriver ; import org . openqa . seleni...
-
package com.practiceCode; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import org.openqa.sel...
No comments:
Post a Comment