Created
February 6, 2014 06:36
-
-
Save akshay-bhardwaj/8839306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.By; | |
import org.openqa.selenium.Cookie; | |
import org.openqa.selenium.Platform; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.WebElement; | |
import org.openqa.selenium.chrome.ChromeOptions; | |
import org.openqa.selenium.remote.CapabilityType; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
import java.io.File; | |
import java.net.URL; | |
public class ProdTest { | |
public static final String USERNAME = "<username>"; | |
public static final String AUTOMATE_KEY = "<access_key>"; | |
public static final String URL = "http://" + USERNAME + ":" + AUTOMATE_KEY + "@hub.browserstack.com/wd/hub"; | |
public static void main(String[] args) throws Exception { | |
// Input capablities | |
DesiredCapabilities caps = new DesiredCapabilities(); | |
caps.setCapability("browser", "ie"); | |
caps.setCapability("browser_version", "10.0"); | |
caps.setCapability("os", "Windows"); | |
caps.setCapability("os_version", "8"); | |
caps.setCapability("browserstack.debug", "true"); | |
caps.setCapability("build", "akshay-test"); | |
String PROXY = "<host>:<port>"; | |
org.openqa.selenium.Proxy proxy = new org.openqa.selenium.Proxy(); | |
proxy.setHttpProxy(PROXY) | |
.setFtpProxy(PROXY) | |
.setSslProxy(PROXY); | |
caps.setCapability(CapabilityType.PROXY, proxy); | |
WebDriver driver = new RemoteWebDriver(new URL(URL), caps); | |
driver.get("http://www.google.com"); | |
System.out.println("And the Title is: " + driver.getTitle()); | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same here. I am also getting connection refused error. How to fix this?