Package org.openqa.selenium

Examples of org.openqa.selenium.JavascriptExecutor.executeScript()


  }

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

  public static void clickAndConfirm(By by) {
    chromeConfirmYes();
View Full Code Here


    }

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

    public void close() {
View Full Code Here

     *
     * @param locator
     */
    public void clickLinkAfterAnimation(By locator) {
        JavascriptExecutor executor = (JavascriptExecutor) getDriver();
        executor.executeScript("arguments[0].click();", getDriver()
                .findElement(locator));
    }

    public void clickLinkAfterAnimation(WebElement element) {
        JavascriptExecutor executor = (JavascriptExecutor) getDriver();
View Full Code Here

                .findElement(locator));
    }

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

    public HelpPage goToHelp() {
        log.info("Click Help");
        WebElement help_link = getDriver().findElement(By.id("help_link"));
View Full Code Here

   */
  @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

    @Override
    protected void succeeded(Description description) {
        JavascriptExecutor executor = (JavascriptExecutor) driver;
        assertEquals("Should be no errors in javascript",
                executor.executeScript("return window.allureErrors.length"), 0L);
    }

    @Override
    protected void finished(Description description) {
        driver.quit();
View Full Code Here

   */
  @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

     */
    public void clickButtonByLocalId(String localId) {
        JavascriptExecutor jsExecutor = (JavascriptExecutor) testCase.getDriver();
        String query = "var cmp = $A.getQueryStatement().from('component').field('globalId').field('localId')"
                + ".where(\"localId === '" + localId + "'\").query();return cmp.rows[0].globalId";
        String globalId = jsExecutor.executeScript(query).toString();
        jsExecutor.executeScript("$A.getCmp(\"" + globalId + "\").get('e.press').fire()");
    }

    /**
     * Click the 'Fix!' button and verify text displayed in browser either from newly loaded component, or any error
View Full Code Here

    public void clickButtonByLocalId(String localId) {
        JavascriptExecutor jsExecutor = (JavascriptExecutor) testCase.getDriver();
        String query = "var cmp = $A.getQueryStatement().from('component').field('globalId').field('localId')"
                + ".where(\"localId === '" + localId + "'\").query();return cmp.rows[0].globalId";
        String globalId = jsExecutor.executeScript(query).toString();
        jsExecutor.executeScript("$A.getCmp(\"" + globalId + "\").get('e.press').fire()");
    }

    /**
     * Click the 'Fix!' button and verify text displayed in browser either from newly loaded component, or any error
     * message that is displayed on failure.
View Full Code Here

   */
  @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

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.