Examples of JavascriptExecutor


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

      /*
       * 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.BROWSER);

View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

     * 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.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.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

          driver.findElement(destElement).sendKeys(trip.getDestination());
          driver.findElement(By.xpath("html/body/div[9]/div/ul/li")).click();

          // attesa
          waitingRandomSec(5);
          JavascriptExecutor js = (JavascriptExecutor) driver;

          // partenza
          js.executeScript(" document.getElementById('ControlGroupRibbonAnonHomeView_AvailabilitySearchInputRibbonAnonHomeView_DepartureDate').value='"
              + trip.getFormattedDepartureDate() + "';");

          // arrivo
          js.executeScript(" document.getElementById('ControlGroupRibbonAnonHomeView_AvailabilitySearchInputRibbonAnonHomeView_ReturnDate').value='"
              + trip.getFormattedArrivalDate() + "';");

          driver
              .findElement(
                  By.id("ControlGroupRibbonAnonHomeView_AvailabilitySearchInputRibbonAnonHomeView_ButtonSubmit"))
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

   *             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

  }

  //@JavascriptEnabled
  @Test
  public void testJavaScriptShouldExecuteInTheContextOfTheCurrentFrame() {
    JavascriptExecutor executor = (JavascriptExecutor) driver;

    driver.get(pages.framesetPage);
    assertTrue((Boolean) executor.executeScript("return window == window.top"));
    driver.switchTo().frame("third");
    assertTrue((Boolean) executor.executeScript("return window != window.top"));
  }
View Full Code Here

Examples of org.openqa.selenium.JavascriptExecutor

  public JasmineResult execute(URL runnerUrl, File junitXmlReport, WebDriver driver, int timeout, boolean debug, Log log, String format) {
    try {
      if (!(driver instanceof JavascriptExecutor)) {
        throw new RuntimeException("The provided web driver can't execute JavaScript: " + driver.getClass());
      }
      JavascriptExecutor executor = (JavascriptExecutor) driver;
      driver.get(runnerUrl.toString());
      this.waitForRunnerToFinish(driver, timeout, debug, log);

      this.checkForConsoleErrors(driver, log);
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.