Search in sources :

Example 1 with HasInputDevices

use of org.openqa.selenium.interactions.HasInputDevices in project java.webdriver by sayems.

the class Action method getKeyboard.

@Override
public Keyboard getKeyboard() {
    HasInputDevices t = (HasInputDevices) driver();
    waitForPageToLoad();
    return t.getKeyboard();
}
Also used : HasInputDevices(org.openqa.selenium.interactions.HasInputDevices)

Example 2 with HasInputDevices

use of org.openqa.selenium.interactions.HasInputDevices in project java.webdriver by sayems.

the class Action method getMouse.

@Override
public Mouse getMouse() {
    HasInputDevices t = (HasInputDevices) driver();
    waitForPageToLoad();
    return t.getMouse();
}
Also used : HasInputDevices(org.openqa.selenium.interactions.HasInputDevices)

Example 3 with HasInputDevices

use of org.openqa.selenium.interactions.HasInputDevices in project wcomponents by BorderTech.

the class SeleniumWMultiDropdownWebElement method deselectAll.

/**
 * Deselect "all" options. A slight misnomer as the first dropdown will end up with its the first option selected.
 */
public void deselectAll() {
    if (isReadOnly()) {
        throw new SystemException("Cannot deselect all from a read-only WMultiDropdown");
    }
    List<WebElement> dropdowns = getDropdowns();
    if (dropdowns.isEmpty()) {
        // really should not be here but tehre is nothing to do
        LOG.warn("Found an editable WMultiDropdown with no select elements");
        return;
    }
    WebElement dropdown = getFirstDropdown();
    Select se = new Select(dropdown);
    se.selectByIndex(0);
    if (dropdowns.size() == 1) {
        // finished
        return;
    }
    // to remove all the other options shift-click any delete button
    WebElement removeButton = getRemoveButton(dropdowns.get(1));
    WebDriver driver = getDriver();
    if (driver instanceof HasInputDevices) {
        Actions shiftClick = new Actions(driver);
        shiftClick.keyDown(Keys.SHIFT).click(removeButton).keyUp(Keys.SHIFT).perform();
    } else {
        removeButton.sendKeys(Keys.chord(Keys.SHIFT, Keys.SPACE));
    }
    SeleniumWComponentsUtil.waitForPageReady(getDriver());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) SystemException(com.github.bordertech.wcomponents.util.SystemException) HasInputDevices(org.openqa.selenium.interactions.HasInputDevices) Actions(org.openqa.selenium.interactions.Actions) Select(org.openqa.selenium.support.ui.Select) WebElement(org.openqa.selenium.WebElement)

Aggregations

HasInputDevices (org.openqa.selenium.interactions.HasInputDevices)3 SystemException (com.github.bordertech.wcomponents.util.SystemException)1 WebDriver (org.openqa.selenium.WebDriver)1 WebElement (org.openqa.selenium.WebElement)1 Actions (org.openqa.selenium.interactions.Actions)1 Select (org.openqa.selenium.support.ui.Select)1