Skip to content

Instantly share code, notes, and snippets.

@omerjerk
Last active July 11, 2016 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omerjerk/e159a6c05f6ec5cff9f8d42dbcec5040 to your computer and use it in GitHub Desktop.
Save omerjerk/e159a6c05f6ec5cff9f8d42dbcec5040 to your computer and use it in GitHub Desktop.
package com.company;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
public class Main {
public static final String USERNAME = "umair60";
public static final String AUTOMATE_KEY = "drLvL9QLbYvRA3tz7NYB";
public static final String URL_ENDPOINT = "https://" + USERNAME + ":" + AUTOMATE_KEY + "@hub-cloud.browserstack.com/wd/hub";
public static void main(String[] args) throws Exception {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browser", "Firefox");
caps.setCapability("browser_version", "4.0");
caps.setCapability("os", "OS X");
caps.setCapability("os_version", "El Capitan");
caps.setCapability("resolution", "1024x768");
caps.setCapability("browserstack.debug", "true");
caps.setCapability("browserstack.local", "true");
WebDriver driver = new RemoteWebDriver(new URL(URL_ENDPOINT), caps);
driver.get("http://google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("omerjerk");
element.submit();
System.out.println(driver.getTitle());
driver.quit();
System.out.println("We're done.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment