package com.SeleniumGridByCloud;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
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 RunSeleniumGridOnCloud {
public WebDriver driver;
public static final String USERNAME= "USERNAME";
public static final String AUTOMATE_KEY= "ACCESS_KEY";
public static final String URL = "https://" + USERNAME + ":" + AUTOMATE_KEY
+ "@hub-cloud.browserstack.com/wd/hub";
@BeforeClass
public void setUp() {
try {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "IE");
caps.setCapability("browser_version", "10.0");
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "XP");
caps.setCapability("browserstack.debug", "true");
driver = new RemoteWebDriver(new URL(URL), caps);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@Test
public void testSeleniumGridOnFirefox() {
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