Package org.openqa.selenium

Examples of org.openqa.selenium.NoSuchElementException


  public WebElement findElementByPartialLinkText(String linkText) {
    assertElementNotStale();

    List<WebElement> elements = findElementsByPartialLinkText(linkText);
    if (elements.size() == 0) {
      throw new NoSuchElementException(
          "Unable to find element with linkText " + linkText);
    }
    return elements.size() > 0 ? elements.get(0) : null;
  }
View Full Code Here


  public WebElement findElementByTagName(String name) {
    assertElementNotStale();

    List<WebElement> elements = findElementsByTagName(name);
    if (elements.size() == 0) {
      throw new NoSuchElementException("Cannot find element with tag name: " + name);
    }
    return elements.get(0);
  }
View Full Code Here

    public WebElement findElement() {
        SlowLoadingElement loadingElement = new SlowLoadingElement(clock, timeOutInSeconds);
        try {
            return loadingElement.get().getElement();
        } catch (NoSuchElementError e) {
            throw new NoSuchElementException(
                    String.format("Timed out after %d seconds. %s", timeOutInSeconds, e.getMessage()),
                    e.getCause());
        }
    }
View Full Code Here

        @Override
        protected void isLoaded() throws Error {
            try {
                element = AjaxElementLocator.super.findElement();
                if (!isElementUsable(element)) {
                    throw new NoSuchElementException("Element is not usable");
                }
            } catch (NoSuchElementException e) {
                lastException = e;
                // Should use JUnit's AssertionError, but it may not be present
                throw new NoSuchElementError("Unable to locate the element", e);
View Full Code Here

            if (button.isSelected()) {
                return button;
            }
        }

        throw new NoSuchElementException("No selected button");
    }
View Full Code Here

                selectButton(button);
                return;
            }
        }

        throw new NoSuchElementException(String.format("Cannot locate radio button with value: %s", value));
    }
View Full Code Here

     */
    public void selectByIndex(int index) {
        List<WebElement> buttons = getButtons();

        if (index < 0 || index >= buttons.size()) {
            throw new NoSuchElementException(String.format("Cannot locate radio button with index: %d", index));
        }

        selectButton(buttons.get(index));
    }
View Full Code Here

            @Override
            public Object getTarget() {
                try {
                    return dropProxyAndFindElement(by, searchContext);
                } catch (NoSuchElementException ex) {
                    throw new NoSuchElementException((by instanceof ByIdOrName ? EMPTY_FIND_BY_WARNING : "") + ex.getMessage(),
                            ex);
                }
            }
        });
    }
View Full Code Here

            driver.findElement(By.id("Email")).sendKeys(email);
            driver.findElement(By.id("Passwd")).sendKeys(pw);
            driver.findElement(By.id("signIn")).submit();
        } catch (NoSuchElementException nsee) {
            String errMsg = driver.getCurrentUrl() + " ----- " + driver.getPageSource();
            throw new NoSuchElementException(nsee.toString() + " ----- " + errMsg);
        }

        try {
            WebElement button = driver.findElement(By.id("submit_approve_access"));
            Graphene.waitModel(driver).withTimeout(5, TimeUnit.SECONDS).until().element(button).is().enabled();
View Full Code Here

  }

  @Override
  protected WebElement getDelegate() {
    long startTime = System.currentTimeMillis();
    NoSuchElementException exception;
    do {
      try {
        return elementLocator.findElement();
      } catch (NoSuchElementException e) {
        exception = e;
View Full Code Here

TOP

Related Classes of org.openqa.selenium.NoSuchElementException

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.