Package org.openqa.selenium

Examples of org.openqa.selenium.WebDriver


   * Return a WebDriver for the window with one of the specified titles
   */
  public WebDriver findPopup(String[] titles) {
    if (titles == null || titles.length == 0)
      return null;
    WebDriver webDriver = getWebDriver();
    WebDriver popup = null;
    Set<String> windowHandles = webDriver.getWindowHandles();
    Iterator<String> windowIterator = windowHandles.iterator();
    while (windowIterator.hasNext()) {
      String windowHandle = windowIterator.next();
      popup = webDriver.switchTo().window(windowHandle);
      String title = popup.getTitle();
      for (int i = 0; i < titles.length; i++) {
        if (title != null && title.contains(titles[i])) {
          return popup;
        }
      }
View Full Code Here


   * This method hovers over the card's attach point and then clicks the hover menu which appears. This should bring up the VCard.
   *
   * @return True if the ProfileCard appeared, false if not.
   */
  public boolean isProfileCardDisplayable(WebElement cardAttachPoint){
    WebDriver driver = getWebDriver();
   
    new Actions(driver).moveToElement(cardAttachPoint).perform(); // hover over the attachpoint to make the semtagmenu appear.
   
    WebDriverWait wait = new WebDriverWait(driver, 5);
    WebElement semtagmenu = wait.until(ExpectedConditions.elementToBeClickable(By.id("semtagmenu"))); // wait until the hover menu is clickable.
View Full Code Here

    System.out.println("taking screenshot");
    File snap = null;
    try {
      if (environment.isTakeScreenshots()) {

        WebDriver wd = environment.getCurrentDriver();
        snap = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE);
        File dest = new File(environment.getScreenshotsPath(), this
            .getClass().getName());
        String sc = environment.isSmartCloud() ? "smartcloud-"
            : "connections-";
View Full Code Here

  public void logTransport() {
    if (!environment.isDebugTransport()) {
      return;
    }

    WebDriver webDriver = environment.getCurrentDriver();
    WebElement mockData = webDriver.findElement(By.id("mockData"));
    if (mockData != null) {
      Trace.log(mockData.getText());
    }
  }
View Full Code Here

        return takeScreenshot(new File(fileName), type);
    }

    @Override
    public Screenshot takeScreenshot(File screenshotToTake, ScreenshotType type) {
        WebDriver browser = getTakingScreenshotsBrowser();

        screenshotToTake = new File(screenshotTargetDir, screenshotToTake.getPath());
        File targetDir = getJustTargetDir(screenshotToTake);
        RecorderFileUtils.createDirectory(targetDir);
        try {
View Full Code Here

        return screenshoot;
    }

    private WebDriver getTakingScreenshotsBrowser() {
        WebDriver result = ((GrapheneProxyInstance) (GrapheneContext.getContextFor(Default.class)
            .getWebDriver(TakesScreenshot.class))).unwrap();
        if (result instanceof ReusableRemoteWebDriver) {
            result = new Augmenter().augment(result);
        }
        return result;
View Full Code Here

    @Test
    public void test_webDriver_methods_which_should_not_return_proxy() {
        IsNotProxyable isNotProxyable = new IsNotProxyable();

        // when
        WebDriver driver = Mockito.mock(WebDriver.class, isNotProxyable);
        Options options = mock(Options.class, isNotProxyable);
        Navigation navigation = mock(Navigation.class, isNotProxyable);
        ImeHandler ime = mock(ImeHandler.class, isNotProxyable);
        Logs logs = mock(Logs.class, isNotProxyable);

        // then
        try {
            driver.toString();
            driver.close();
            driver.equals(new Object());
            driver.get("");
            driver.getClass();
            driver.getCurrentUrl();
            driver.getPageSource();
            driver.getTitle();
            driver.getWindowHandle();
            driver.hashCode();
            driver.quit();
            driver.toString();

            options.addCookie(mock(Cookie.class));
            options.deleteAllCookies();
            options.deleteCookie(mock(Cookie.class));
            options.deleteCookieNamed("");
View Full Code Here

    @Test
    public void test_webDriver_methods_which_should_return_proxy() {
        IsProxyable isProxyable = new IsProxyable();

        // when
        WebDriver driver = Mockito.mock(WebDriver.class, isProxyable);
        Options options = mock(Options.class, isProxyable);
        TargetLocator targetLocator = mock(TargetLocator.class, isProxyable);
        ImeHandler ime = mock(ImeHandler.class, isProxyable);
        Timeouts timeouts = mock(Timeouts.class, isProxyable);

        // then
        try {
            driver.manage();
            driver.navigate();
            driver.switchTo();
            driver.findElement(By.className(""));
            driver.findElements(By.className(""));
            driver.getWindowHandles();

            options.ime();
            options.logs();
            options.timeouts();
            options.window();
View Full Code Here

        InterceptorBuilder builder = new InterceptorBuilder();
        builder.interceptInvocation(WebDriver.class, interceptor1).findElement(Interceptors.any(By.class));
        builder.interceptInvocation(WebDriver.class, interceptor2).findElement(Interceptors.any(By.class));
        Interceptor builtInterceptor = builder.build();

        WebDriver driverProxy = GrapheneProxy.getProxyForTargetWithInterfaces(context, driver, WebDriver.class);
        GrapheneProxyInstance proxy = (GrapheneProxyInstance) driverProxy;

        proxy.registerInterceptor(builtInterceptor);
        driverProxy.findElement(by);

        Mockito.inOrder(interceptor1, interceptor2);
        verify(interceptor1).intercept(Mockito.any(InvocationContext.class));
        verify(interceptor2).intercept(Mockito.any(InvocationContext.class));
    }
View Full Code Here

    }

    public <T> T goTo(Class<T> pageObject, Class<?> browserQualifier) {
        T result = null;
        GrapheneContext grapheneContext = GrapheneContext.getContextFor(browserQualifier);
        WebDriver browser = grapheneContext.getWebDriver();
        try {
            result = PageObjectEnricher.setupPage(grapheneContext, browser, pageObject);
        } catch (Exception e) {
            throw new GrapheneTestEnricherException("Error while initializing: " + pageObject, e);
        }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.WebDriver

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.