Sap Driver Element
Sap Driver Element
The SapDriver based on ActiveXComponent from the Jacob library (JAVA-COM Bridge), which corresponds to the structure element of the SAP application.
SapPElement e1 = getDriver().findElementById("foo"); SapPElement e2 = getDriver().findElementByName("bar");
Instance Methods
click
This emulates manually pressing a button
getDisplayedText
Returnes DisplayedText propertywhich contains the text as it is displayed on the screen, including preceding or trailing blanks.
sendKeys
The sendKeys (int keyKode) method takes a code of key or shortcut key as an argument. Performs underlying
setText
callelement.sendKeys(SapKeyCode.CTRL_V); element.sendKeys(SapKeyCode.ENTER);
setText
Sets the value of
text
property.
The value very much depends on the type of the object on which it is called. This is obvious for text fields or menu items. On the other hand this property is empty for toolbar buttons and is the class id for shells. You can read
the text property of a label, but you can’t change it, whereas you can only set the text property of a password field, but not read it.selectDropDownByKey
Sets the value of the "key" property which is the key of the currently selected item.
getTableRowByIndex
The method takes the table row index as a parameter and returns SapPElement corresponding to this row
The indexing supported by this function does not reset the index after scrolling, but counts the rows starting with the first row with respect to the first scroll position. If the selected row is not currently visible then an exception is raised.SapPElement row = table.getTableRowByIndex(3);
checkBoxCheck and checkBoxUncheck
Changes the
Selected
property, which checks and unchecks the checkbox element.sendEnter
Emulates pressing the Enter key.
element.sendEnter(); //the same element.sendKeys(SapKeyCode.ENTER);
sendExit
Emulates pressing the Shift+F3 key shortcut.
element.sendExit(); //the same element.sendKeys(SapKeyCode.SHIFT_F3);