Example usage for org.openqa.selenium By name

List of usage examples for org.openqa.selenium By name

Introduction

In this page you can find the example usage for org.openqa.selenium By name.

Prototype

public static By name(String name) 

Source Link

Usage

From source file:com.github.wiselenium.testng.WiseTestTest.java

License:Open Source License

@Test
public void shouldFindElements() {
    List<Radiobutton> radiobuttons = this.findElements(Radiobutton.class, By.name("sex"));
    assertNotNull(radiobuttons);/*  w ww.  ja v  a  2s.c o m*/
    assertFalse(radiobuttons.isEmpty());
}

From source file:com.gkopevski.fuelcheck.FuelCheckForm.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    try {//w  w  w  .  j a va2 s  .c o  m
        // Create a new instance of the html unit driver
        // Notice that the remainder of the code relies on the interface, 
        // not the implementation.
        driver = new PhantomJSDriver();
        ;

        // And now use this to visit Google
        driver.get("http://www.google.com");

        // Find the text input element by its name
        WebElement element = driver.findElement(By.name("q"));

        // Enter something to search for
        element.sendKeys("Cheese!");

        // Now submit the form. WebDriver will find the form for us from the element
        element.submit();

        // Check the title of the page
        System.out.println("Page title is: " + driver.getTitle());

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.google.appengine.tck.env.appspot.AppspotLoginHandler.java

License:Open Source License

public void login(WebDriver driver, LoginContext context) {
    try {/*from   w w  w  .  ja  v a  2 s  . c  o  m*/
        WebElement email = driver.findElement(By.id("Email"));
        if (email.getAttribute("readonly") == null) {
            email.clear();
            email.sendKeys(context.getEmail());
        }

        WebElement password = driver.findElement(By.id("Passwd"));
        password.sendKeys(context.getPassword());

        driver.findElement(By.name("signIn")).click();
    } catch (NoSuchElementException e) {
        throw new IllegalStateException(
                String.format("URL[%s]\n\n%s", driver.getCurrentUrl(), driver.getPageSource()), e);
    }
}

From source file:com.guidewire.pstesting.policycenter.submission.pa.DriverRolesPanel.java

protected void setAccidentViolationLevel(String rowText, int columnIndex, String listItem) {
    if (listItem != null) {
        WebElement rowElement = getController().findRow(accidentsViolationsSummaryTableLocator, rowText);
        WebElement cellElement = rowElement.findElements(By.tagName("td")).get(columnIndex);
        //Cell changes to input once list is invoked - use name attribute for each
        By cellInputLocator = By.name("c" + columnIndex);
        By listLocator = By.className("x-list-plain");
        try {/* www.  j  a  va  2 s.  c o  m*/
            getController().clickRightEdgeAndWait(cellElement, listLocator);
        } catch (Exception e) {
            getController().clickAndWaitFluently(cellElement, listLocator);
        }
        getController().setTextAndTab(cellInputLocator, listItem);
    }
}

From source file:com.hotwire.selenium.angular.AngularFareFinderFragment.java

License:Open Source License

public AngularFareFinderFragment(WebDriver webdriver) {
    super(webdriver, By.cssSelector(".site-content"),
            new Wait<Boolean>(new VisibilityOf(By.name("destination"))));
    dateFormat = DatePicker.getDateFormat(DateFormats.DESKTOP_US_YYYY);
}

From source file:com.hotwire.selenium.desktop.common.billing.HotelBillingPage.java

License:Open Source License

public WebElement getCity() {
    try {/*from  www .  ja  v  a 2  s  . c o m*/
        return getWebDriver().findElement(By.name("paymentInfoModel.newCreditCard.city"));
    } catch (NoSuchElementException e) {
        return null;
    }
}

From source file:com.hotwire.selenium.desktop.helpCenter.HCContactUsForm.java

License:Open Source License

public WebElement getFormElementByName(String name) {
    return new WebDriverWait(getWebDriver(), 1)
            .until(ExpectedConditions.presenceOfElementLocated(By.name(name)));
}

From source file:com.hotwire.selenium.desktop.helpCenter.HCContactUsForm.java

License:Open Source License

public String getFormElementValueByName(String name) {
    return new WebDriverWait(getWebDriver(), 1)
            .until(ExpectedConditions.presenceOfElementLocated(By.name(name))).getAttribute("value");
}

From source file:com.hotwire.selenium.desktop.paypal.PayPalConfirmationPage.java

License:Open Source License

public PayPalConfirmationPage(WebDriver webdriver) {
    super(webdriver, new Wait<Boolean>(new VisibilityOf(By.name("merchant_return_link"))).maxWait(20));

}

From source file:com.hotwire.selenium.desktop.refreshUtil.RefreshUtilPage.java

License:Open Source License

public RefreshUtilPage(WebDriver webdriver) {
    super(webdriver, By.name("updatePropertyForm"));
}