Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions


            stored = sessionStore.get().pull(initParam);
        }

        if (driver == null) {
            // if either browser session isn't stored or can't be reused
            RemoteWebDriver newdriver = createRemoteDriver(remoteAddress, desiredCapabilities);
            driver = ReusableRemoteWebDriver.fromRemoteWebDriver(newdriver);
        }

        initParams.get().put(driver.getSessionId(), initParam);
        return driver;
View Full Code Here


      // not throw RuntimeExcption direct?
      LOGGER.error("Received unknown exception while creating the "
              + "HttpCommandExecutor, can not continue!", e);
      return null;
    }
    return new RemoteWebDriver(executor, capabilities);
  }
View Full Code Here

import org.openqa.selenium.remote.RemoteWebDriver;

public class RStudioWebAppDriver
{
   public static WebDriver start() throws Exception {
      driver_ = new RemoteWebDriver(
            new URL("http://localhost:9515/"), DesiredCapabilities.chrome());
     
      driver_.get("http://localhost:4011/");
      return driver_;
   }
View Full Code Here

  }

  @Test
  public void canSeeAlertsAsWebElements() throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    Criteria
        c =
        new AndCriteria(new TypeCriteria(UIAStaticText.class), new NameCriteria("Show Simple"));
    UIAElement el = driver.findElements(c).get(1);
    try {
      d.findElement(By.className("UIAAlert"));
      Assert.fail("should not find alert when there isn't any");
    } catch (NoSuchElementException e) {
      //ignore
    }

    // opens an alert.
    el.tap();

    WebElement rwe = d.findElement(By.className("UIAAlert"));
    String json = rwe.getAttribute("tree");
    JSONObject tree = new JSONObject(json);
    Assert.assertEquals(tree.getString("type"), "UIAAlert");
    // IOS 6. Alert OK buttons are buttons.
    String version = driver.getCapabilities().getSDKVersion();
View Full Code Here

  }


  @Test
  public void switchToAlert() throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath("//UIAStaticText[@name='Secure Text Input']");
    WebElement el = driver.findElement(b);
    try {
      d.switchTo().alert();
      Assert.fail("should have thrown");
    } catch (NoAlertPresentException e) {
      // expected
    }
    el.click();
    Alert alert = d.switchTo().alert();
    alert.sendKeys("test");
    alert.accept();
  }
View Full Code Here

    };
  }

  @Test(dataProvider = "allAlerts")
  public void dismissAlert(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    alert.dismiss();

    try {
      d.switchTo().alert();
      Assert.fail("alert should be gone.");
    } catch (NoAlertPresentException e) {
      // expected
    }
  }
View Full Code Here

    }
  }

  @Test(dataProvider = "allAlerts")
  public void acceptAlert(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    alert.accept();

    try {
      d.switchTo().alert();
      Assert.fail("alert should be gone.");
    } catch (NoAlertPresentException e) {
      // expected
    }
  }
View Full Code Here

    };
  }

  @Test(dataProvider = "non-input")
  public void sendKeysAlertThrowsIfNoInput(String alertLocator) throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
View Full Code Here

    alert.dismiss();
  }

  @Test
  public void sendKeysAlert() throws Exception {
    RemoteWebDriver d = (RemoteWebDriver) driver;
    By b = By.xpath(alertPassword);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    WebElement field = driver.findElement(By.xpath("//UIAAlert//UIASecureTextField"));
    Assert.assertEquals(field.getAttribute("value"), "");
    alert.sendKeys("test");
    Assert.assertEquals(field.getAttribute("value"), "••••");
    alert.accept();

    try {
      d.switchTo().alert();
      Assert.fail("alert should be gone.");
    } catch (NoAlertPresentException e) {
      // expected
    }
  }
View Full Code Here

    String[] param = {"-port", "4444", "-host", "localhost"};
    IOSServerConfiguration config = IOSServerConfiguration.create(param);
    IOSServer server = new IOSServer(config);
    server.start();

    RemoteWebDriver driver = null;

    URL url = new URL("http://localhost:4444/wd/hub");
    IOSCapabilities caps = IOSCapabilities.iphone("Safari");
    driver = new RemoteWebDriver(url, caps);

    HttpClient client = HttpClientFactory.getClient();
    String s = url + "/status";
    URL u = new URL(s);
    BasicHttpEntityEnclosingRequest
        r =
        new BasicHttpEntityEnclosingRequest("GET", u.toExternalForm());

    HttpHost h = new HttpHost(u.getHost(), u.getPort());
    HttpResponse response = client.execute(h, r);

    JSONObject o = Helper.extractObject(response);
    File base = new File("server/src/test/resources/mock");
    File status = new File(base, "status.json");

    FileWriter writer = new FileWriter(status);
    writer.write(o.toString(2));
    writer.close();
    driver.quit();
    server.stop();
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.