Examples of executeScript()


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

  @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"));
  }

  private void assertFrameNotPresent(WebDriver driver, String locator) {
View Full Code Here

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

    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"));
  }

  private void assertFrameNotPresent(WebDriver driver, String locator) {
    long end = System.currentTimeMillis() + TIMEOUT;
View Full Code Here

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

    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();
View Full Code Here

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

    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.executeScript()

      /*
       * 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.executeScript()

     * below for No.
     */

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

  public static void chromeConfirmNo() {
    // if (Config.inst().BROWSER.equals("chrome")) {
View Full Code Here

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

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

    }

    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

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

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

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

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