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();
}
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();
}
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());
}
Aggregations