Java Code Examples for org.openqa.selenium.firefox.FirefoxDriver#get()

The following examples show how to use org.openqa.selenium.firefox.FirefoxDriver#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FirefoxTest.java    From selenium-example with MIT License 6 votes vote down vote up
@Before
public void prepare() {

    testUrl = "https://leftstick.github.io/";

    System.setProperty("webdriver.gecko.driver","webdriver/geckodriver");

    // Create a new instance of the Chrome driver
    // Notice that the remainder of the code relies on the interface,
    // not the implementation.
    driver = new FirefoxDriver();

    // And now use this to visit myBlog
    // Alternatively the same thing can be done like this
    // driver.navigate().to(testUrl);
    driver.get(testUrl);
}
 
Example 2
Source File: ProxyBasedIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 6 votes vote down vote up
@Test
public void usingAProxyToTrackNetworkTrafficStep2() {
    BrowserMobProxy browserMobProxy = new BrowserMobProxyServer();
    browserMobProxy.start();
    Proxy seleniumProxyConfiguration = ClientUtil.createSeleniumProxy(browserMobProxy);

    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability(CapabilityType.PROXY, seleniumProxyConfiguration);
    driver = new FirefoxDriver(firefoxOptions);
    browserMobProxy.newHar();
    driver.get("https://www.google.co.uk");

    Har httpArchive = browserMobProxy.getHar();

    assertThat(getHTTPStatusCode("https://www.google.co.uk/", httpArchive))
            .isEqualTo(200);
}
 
Example 3
Source File: VIPPS_WebPageButtonClicker.java    From vipps-developers with MIT License 6 votes vote down vote up
public static boolean main(String url) throws Exception {

    System.setProperty("webdriver.gecko.driver", VIPPS_APIKeys.geckodriverLocation);

    System.out.println("WebpagebuttonClicker activated!");

    driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

    driver.get(url);

    if (isElementPresent(By.id("okButton"))) {
      driver.findElement(By.id("okButton")).click();
      System.out.println("clicked!");
      Thread.sleep(3000);
    } else System.out.println("ID: \"okButton\" not found!");
    driver.quit();
    return true;
  }
 
Example 4
Source File: FirefoxSettingPreferences.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 5 votes vote down vote up
public static void main(String... args) {

        System.setProperty("webdriver.gecko.driver",
                "./src/test/resources/drivers/geckodriver 2");

        FirefoxProfile profile = new FirefoxProfile();
        profile.setPreference("general.useragent.override",
                "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) " +
                        "AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 " +
                        " Mobile/15A356 Safari/604.1");
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setProfile(profile);
        FirefoxDriver driver = new FirefoxDriver(firefoxOptions);
        driver.get("http://facebook.com");
    }
 
Example 5
Source File: IntegrationTest.java    From spring-security-saml-dsl with MIT License 5 votes vote down vote up
@Before
public void setup() {
	driver = new FirefoxDriver();
	driver.manage().deleteAllCookies();
	driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);

	baseUrl = String.format("https://localhost:%d", port);
	driver.get(baseUrl);
}
 
Example 6
Source File: LocalWebDriverTest.java    From Mastering-Software-Testing-with-JUnit-5 with MIT License 5 votes vote down vote up
@Test
public void testWithFirefoxAndOpera(FirefoxDriver firefox,
        OperaDriver opera) {
    firefox.get("http://www.seleniumhq.org/");
    opera.get("http://junit.org/junit5/");

    assertTrue(firefox.getTitle().startsWith("Selenium"));
    assertTrue(opera.getTitle().equals("JUnit 5"));
}
 
Example 7
Source File: ProxyBasedIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 5 votes vote down vote up
@Test
public void usingAProxyToTrackNetworkTrafficStep1() {
    BrowserMobProxy browserMobProxy = new BrowserMobProxyServer();
    browserMobProxy.start();
    Proxy seleniumProxyConfiguration = ClientUtil.createSeleniumProxy(browserMobProxy);

    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability(CapabilityType.PROXY, seleniumProxyConfiguration);
    driver = new FirefoxDriver(firefoxOptions);
    browserMobProxy.newHar();
    driver.get("https://www.google.co.uk");
}
 
Example 8
Source File: FirefoxJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Disabled("Redudant test for Travis CI suite")
// tag::snippet-in-doc[]
@Test
public void testWithTwoFirefoxs(FirefoxDriver driver1,
        FirefoxDriver driver2) {
    driver1.get("http://www.seleniumhq.org/");
    driver2.get("http://junit.org/junit5/");
    assertThat(driver1.getTitle(), startsWith("Selenium"));
    assertThat(driver2.getTitle(), equalTo("JUnit 5"));
}
 
Example 9
Source File: MultipleConfigWdmJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
void multipleConfigTest(ChromeDriver chrome, FirefoxDriver firefox) {
    String sut = "https://bonigarcia.github.io/selenium-jupiter/";
    String title = "JUnit 5 extension for Selenium";

    chrome.get(sut);
    firefox.get(sut);

    assertThat(chrome.getTitle(), containsString(title));
    assertThat(firefox.getTitle(), containsString(title));
}
 
Example 10
Source File: FirefoxWithGlobalOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
public void webrtcTest(FirefoxDriver driver) {
    driver.get(
            "https://webrtc.github.io/samples/src/content/devices/input-output/");
    assertThat(driver.findElement(By.id("video")).getTagName(),
            equalTo("video"));
}
 
Example 11
Source File: FirefoxWithOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
public void webrtcTest(@Arguments("-private") @Preferences({
        "media.navigator.permission.disabled=true",
        "media.navigator.streams.fake=true" }) FirefoxDriver driver) {
    driver.get(
            "https://webrtc.github.io/samples/src/content/devices/input-output/");
    assertThat(driver.findElement(By.id("video")).getTagName(),
            equalTo("video"));
}
 
Example 12
Source File: SeleniumJupiterTest.java    From selenium-jupiter with Apache License 2.0 5 votes vote down vote up
@Test
public void testWithChromeAndFirefox(ChromeDriver driver1,
        FirefoxDriver driver2) {
    driver1.get("http://www.seleniumhq.org/");
    driver2.get("http://junit.org/junit5/");
    assertThat(driver1.getTitle(), startsWith("Selenium"));
    assertThat(driver2.getTitle(), equalTo("JUnit 5"));
}
 
Example 13
Source File: FluentWebElementUsageTest.java    From webDriverExperiments with MIT License 4 votes vote down vote up
@BeforeClass
public static void setup(){
    driver = new FirefoxDriver();
    driver.get("http://www.compendiumdev.co.uk/selenium/search.php");
}
 
Example 14
Source File: FirefoxJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
public void testWithOneFirefox(FirefoxDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example 15
Source File: FirefoxWithOptionsJupiterTest.java    From selenium-jupiter with Apache License 2.0 4 votes vote down vote up
@Test
void extensionTest(@Extensions("hello_world.xpi") FirefoxDriver driver) {
    driver.get("https://bonigarcia.github.io/selenium-jupiter/");
    assertThat(driver.getTitle(),
            containsString("JUnit 5 extension for Selenium"));
}
 
Example 16
Source File: LocalWebDriverTest.java    From mastering-junit5 with Apache License 2.0 4 votes vote down vote up
@Test
public void testWithFirefox(FirefoxDriver firefox) {
    firefox.get("http://www.seleniumhq.org/");

    assertTrue(firefox.getTitle().startsWith("Selenium"));
}
 
Example 17
Source File: FluentWaitForWebElement.java    From webDriverExperiments with MIT License 4 votes vote down vote up
@BeforeClass
public static void setup(){
    driver = new FirefoxDriver();
    //driver.get("http://stuntsnippets.com/javascript-countdown/");
    driver.get("http://seleniumsimplified.com/testpages/javascript_countdown.html");
}
 
Example 18
Source File: FluentWaitForWebElement.java    From webDriverExperiments with MIT License 4 votes vote down vote up
@BeforeClass
public static void setup(){
    driver = new FirefoxDriver();
    //driver.get("http://stuntsnippets.com/javascript-countdown/");
    driver.get("http://seleniumsimplified.com/testpages/javascript_countdown.html");
}
 
Example 19
Source File: FluentWebElementUsageTest.java    From webDriverExperiments with MIT License 4 votes vote down vote up
@BeforeClass
public static void setup(){
    driver = new FirefoxDriver();
    driver.get("http://www.compendiumdev.co.uk/selenium/search.php");
}
 
Example 20
Source File: SearchTestWithFirefox.java    From Selenium-WebDriver-3-Practical-Guide-Second-Edition with MIT License 3 votes vote down vote up
@BeforeMethod
public void setup() {


    System.setProperty("webdriver.gecko.driver",
            "./src/test/resources/drivers/geckodriver 2");

    driver = new FirefoxDriver();
    driver.get("http://demo-store.seleniumacademy.com/");
}