Open
Description
Add to Element.java a new keyword Press Key Native. Prototype see below.
Goal: Elements like scrollbar are not coded in html. Therefore a locator can only hit the whole element and not single control elements. Keys like page up/down can be used instead.
The keyword Press Key only accepts ASCII characters. To use other keys (see http://docs.oracle.com/javase/6/docs/api/constant-values.html#java.awt.event.KeyEvent.CHAR_UNDEFINED) a native version is necessary.
Additional the same keyword without locator could be useful. Compare http://robotframework-seleniumlibrary.googlecode.com/hg/doc/SeleniumLibrary.html?r=2.5#Press%20Key%20Native
/**
- Simulates pressing a key. Helpful for non-ASCII keys like page up/down.
- @param locator
- @param key code for keys see http://docs.oracle.com/javase/6/docs/api/constant-values.html#java.awt.event.KeyEvent.CHAR_UNDEFINED
*/
public void pressKeyNative(final String locator, final String key) {
if (locator == null || key == null) {
info("Keyword needs locator and key => FAILED");
throw new Selenium2LibraryNonFatalException(
"Keyword needs locator and key => FAILED");
}
final List element = elementFind(locator, true, true);
element.get(0).sendKeys(key);
}