Created
February 5, 2014 16:46
-
-
Save akshay-bhardwaj/8827963 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
package juto; | |
import org.openqa.selenium.By; | |
import org.openqa.selenium.Platform; | |
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 FolaSample { | |
public static final String USERNAME = "<username>"; | |
public static final String AUTOMATE_KEY = "<key>"; | |
public static final String URL = "http://" + USERNAME + ":" + AUTOMATE_KEY + "@hub.browserstack.com/wd/hub"; | |
public static void main(String[] args) throws Exception { | |
DesiredCapabilities caps = new DesiredCapabilities(); | |
caps.setCapability("browser", "IE"); | |
caps.setCapability("browser_version", "7.0"); | |
caps.setCapability("os", "Windows"); | |
caps.setCapability("os_version", "XP"); | |
caps.setCapability("browserstack.debug", "true"); | |
WebDriver driver = new RemoteWebDriver(new URL(URL), caps); | |
driver.get("http://www.google.com/ncr"); | |
try{ | |
WebElement element = driver.findElement(By.name("qa")); | |
element.sendKeys("BrowserStack"); | |
element.submit(); | |
} catch(Exception e){ | |
System.out.println("This element was not found: Error " + e.toString()); | |
} | |
System.out.println(driver.getTitle()); | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment