Examples of JavascriptExecutor


Examples of org.openqa.selenium.JavascriptExecutor

        "return junitXmlReporter.report(window.jsApiReporter,"+debug+");");
    return junitReport.toString();
  }

  private void waitForRunnerToFinish(final WebDriver driver, int timeout, boolean debug, Log log) throws InterruptedException {
    final JavascriptExecutor executor = (JavascriptExecutor) driver;
    new WebDriverWait(driver, timeout, 1000).until(new Predicate<WebDriver>() {
      @Override
      public boolean apply(WebDriver input) {
        return SpecRunnerExecutor.this.executionFinished(executor);
      }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

    WebElement processButton;

    public String find(){
        String s = null;
        if (driver instanceof JavascriptExecutor) {
            JavascriptExecutor js = (JavascriptExecutor)driver;
            topTextField.sendKeys(String.valueOf(js.executeScript(TOP_COORDINATE_JS)));
            leftTextField.sendKeys(String.valueOf(js.executeScript(LEFT_COORDINATE_JS)));
            processButton.click();
            Alert alert = driver.switchTo().alert();
            s = alert.getText();
            alert.accept();
            //driver.switchTo().defaultContent();
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

      selenium = new WebDriverBackedSelenium(driver, Config.inst().TEAMMATES_URL);

      /*
       * Chrome hack. Currently Chrome doesn't support confirm() yet. http://code.google.com/p/selenium/issues/detail?id=27
       */
      JavascriptExecutor js = (JavascriptExecutor) driver;
      js.executeScript("window.confirm = function(msg){ return true;};");

    } else {

      System.out.println("Using " + Config.inst().BROWSER);

View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

     * Huy: I have no idea why the driver.switchTo().alert() approach doesn't work even in Firefox (it supposed to!). This is a workaround to press Yes in the confirmation box. Same for function
     * below for No.
     */

    // if (Config.inst().BROWSER.equals("chrome")) {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("window.confirm = function(msg){ return true;};");
    // }
  }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

    // }
  }

  public static void chromeConfirmNo() {
    // if (Config.inst().BROWSER.equals("chrome")) {
    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("window.confirm = function(msg){ return false;};");
    // }
  }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

        sendContextMessage(step);
    }

    private void sendContextMessage(String step) {
        try {
            JavascriptExecutor je = (JavascriptExecutor) webDriverProvider.get();
            je.executeScript("sauce:context=Step: " + step);
        } catch (Exception e) {
        }
    }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

     * clickable at point due to the change coordinate of element in page.
     *
     * @param locator
     */
    public void clickLinkAfterAnimation(By locator) {
        JavascriptExecutor executor = (JavascriptExecutor) getDriver();
        executor.executeScript("arguments[0].click();", getDriver()
                .findElement(locator));
    }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

        executor.executeScript("arguments[0].click();", getDriver()
                .findElement(locator));
    }

    public void clickLinkAfterAnimation(WebElement element) {
        JavascriptExecutor executor = (JavascriptExecutor) getDriver();
        executor.executeScript("arguments[0].click();", element);
    }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

   *             when javascript execution failed.
   */
  @Override
  public Object executeJavaScript(String code) throws CrawljaxException {
    try {
      JavascriptExecutor js = (JavascriptExecutor) browser;
      return js.executeScript(code);
    } catch (WebDriverException e) {
      throwIfConnectionException(e);
      throw new CrawljaxException(e);
    }
  }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

        ((JavascriptExecutor) driver).executeScript(loggingJS);
    }

    @Override
    protected void succeeded(Description description) {
        JavascriptExecutor executor = (JavascriptExecutor) driver;
        assertEquals("Should be no errors in javascript",
                executor.executeScript("return window.allureErrors.length"), 0L);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.