Skip to content

Instantly share code, notes, and snippets.

@krzysdb
Created January 11, 2012 18:29
Show Gist options
  • Save krzysdb/1596037 to your computer and use it in GitHub Desktop.
Save krzysdb/1596037 to your computer and use it in GitHub Desktop.
WebDriverBackedSelenium simple test
import java.net.MalformedURLException;
import java.net.URL;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
@SuppressWarnings("deprecation")
public class WebDriverBackedSelenium_simple extends SeleneseTestCase {
public String SITE_URL = "http://127.0.0.1:4444/wd/hub";
public static Selenium selenium;
@Before
public void setUp() throws Exception {
DesiredCapabilities capabilites = DesiredCapabilities.firefox();
WebDriver driver = null;
try {
driver = new RemoteWebDriver( new URL(SITE_URL), capabilites);
} catch (MalformedURLException e) {
e.printStackTrace();
}
selenium = new WebDriverBackedSelenium(driver,"http://www.google.com/");
selenium.open("/");
selenium.windowFocus();
selenium.windowMaximize();
}
@Test
public void testing(){
selenium.open("http://www.yahoo.com");
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment