Example usage for org.openqa.selenium WebElement click

List of usage examples for org.openqa.selenium WebElement click

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement click.

Prototype

void click();

Source Link

Document

Click this element.

Usage

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void enterText(WebElement wdElement, String value) throws Exception {
    waitForElementClickability(wdElement);
    wdElement.click();
    wdElement.sendKeys(value);//from   www.  j  a  va 2 s  .co m
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void setText(WebElement wdElement, String text) throws Exception {
    this.waitForElementClickability(wdElement);
    wdElement.click();
    wdElement.clear();/*from   www.j a  va 2 s  . c  o  m*/
    wdElement.sendKeys(text);
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void check(WebElement wdElement) {
    if (!isChecked(wdElement)) {
        wdElement.click();
    }
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void uncheck(WebElement wdElement) throws Exception {
    if (isChecked(wdElement)) {
        wdElement.click();
    }//ww  w.jav  a  2s . c  o  m
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void toggle(WebElement wdElement) throws Exception {
    wdElement.click();
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hoverAndClick(WebElement element) throws Exception {
    try {/*ww w.  j  a v  a2 s .  c om*/
        Actions builder = getActionChain();
        builder.moveToElement(element).perform();
        getWaiter().until(ExpectedConditions.elementToBeClickable(element));
        element.click();
    } catch (Exception e) {
        moveToElementAndClick(element);
    }
}

From source file:com.axatrikx.webdriver.AxaDriver.java

License:Apache License

/**
 * Selects the checkbox. Does nothing if already selected
 * //ww  w.  j  a v  a2s. c o  m
 * @param locator
 *            string locator in OR locator format
 */
public void selectCheckBox(String locator) {
    WebElement ele = eleHelper.findElement(locator);
    boolean isSelected = ele.isSelected();
    if (!isSelected) {
        ele.click();
        reporter.log("Action", "Selected checkbox " + locator, ExecutionStatus.INFO);
    } else {
        reporter.log("Action", "Checkbox " + locator + " was already selected", ExecutionStatus.INFO);
    }
}

From source file:com.axatrikx.webdriver.AxaDriver.java

License:Apache License

/**
 * Unselect the checkbox. If already unselected, does nothing.
 * /*from   ww  w .ja  va 2s  .c om*/
 * @param locator
 *            string locator in OR locator format
 */
public void unSelectCheckBox(String locator) {
    WebElement ele = eleHelper.findElement(locator);
    boolean isSelected = ele.isSelected();
    if (isSelected) {
        ele.click();
        reporter.log("Action", "Unselected checkbox " + locator, ExecutionStatus.INFO);
    } else {
        reporter.log("Action", "Checkbox " + locator + " was already unselected", ExecutionStatus.INFO);
    }
}

From source file:com.bc.opec.webtests.WebTestBase.java

License:Open Source License

public void closePopups() {
    Assert.assertTrue(driver.getTitle().startsWith("OPEC"));
    for (WebElement e : driver.findElements(By.tagName("Button"))) {
        if (e.getAttribute("title").equals("Close")) {
            e.click();
            break;
        }/*from  w w  w  .  j a va2  s  .  c om*/
    }
    for (WebElement e : driver.findElements(By.tagName("Button"))) {
        if (e.getText().equals("No")) {
            e.click();
            break;
        }
    }
    driver.findElement(
            By.xpath("//*/div[@aria-describedby='gisportal-layerSelection']/div/div/button[@title='close']"))
            .click();
}

From source file:com.blogspot.jadecalyx.webtools.jcWebPage.java

public void Click(String objectHandle) {
    Stack<jcPageObjectSet> es = _pageObjectHelper.GetLookupDetails(objectHandle);
    WebElement we = extractElement(null, es);
    we.click();
}