KeyBoard Actions
KeyPressOnElement
Description: This function is used to press a key or combination of keys on an element.
Input Format : @Expected Keys or combination. Examples :
F1 - F12, Digit0 - Digit9, KeyA - KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp, etc.
Following modification shortcuts are also supported: Shift, Control, Alt, Meta, ShiftLeft.
Holding down Shift will type the text that corresponds to the key in the upper case.
If key is a single character, it is case-sensitive, so the values a and A will generate different respective texts.
Shortcuts such as key: "Control+o" or key: "Control+Shift+T" are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.
A full list of keys can be found here
| ObjectName | Action | Input | Condition | Reference | |
|---|---|---|---|---|---|
| Object | KeyPressOnElement |
@value | PageName | ||
| Object | KeyPressOnElement |
Sheet:Column | PageName | ||
| Object | KeyPressOnElement |
%dynamicVar% | PageName |
Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the data sheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.
@Action(object = ObjectType.PLAYWRIGHT, desc = "Press the [<Object>] ",input = InputType.YES)
public void KeyPressOnElement() {
try {
Locator.press(Data);
Report.updateTestLog(Action, "Pressed key ["+ Data + "] on " + "["+ObjectName+"]", Status.DONE);
} catch(Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
Report.updateTestLog("Could not perfom ["+Action+"] action", "Error: " + e.getMessage(),Status.FAIL);
}
}
KeyPress
Description: This function is used to press a key or combination of keys .
Input Format : @Expected Keys or combination. Examples :
F1 - F12, Digit0 - Digit9, KeyA - KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp, etc.
Following modification shortcuts are also supported: Shift, Control, Alt, Meta, ShiftLeft.
Holding down Shift will type the text that corresponds to the key in the upper case.
If key is a single character, it is case-sensitive, so the values a and A will generate different respective texts.
Shortcuts such as key: "Control+o" or key: "Control+Shift+T" are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.
A full list of keys can be found here
| ObjectName | Action | Input | Condition | Reference | |
|---|---|---|---|---|---|
| Browser | KeyPress |
@value | PageName | ||
| Browser | KeyPress |
Sheet:Column | PageName | ||
| Browser | KeyPress |
%dynamicVar% | PageName |
Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the data sheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.
@Action(object = ObjectType.PLAYWRIGHT, desc = "Press the [<Object>] ",input = InputType.YES)
public void KeyPressOnElement() {
try {
Locator.press(Data);
Report.updateTestLog(Action, "Pressed key ["+ Data + "] on " + "["+ObjectName+"]", Status.DONE);
} catch(Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
Report.updateTestLog("Could not perfom ["+Action+"] action", "Error: " + e.getMessage(),Status.FAIL);
}
}
KeyUp
Description: This function is used to press up a key or combination of keys .
Input Format : @Expected Keys or combination. Examples : as stated above.
| ObjectName | Action | Input | Condition | Reference | |
|---|---|---|---|---|---|
| Browser | KeyUp |
@value | PageName | ||
| Browser | KeyUp |
Sheet:Column | PageName | ||
| Browser | KeyUp |
%dynamicVar% | PageName |
Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the data sheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.
@Action(object = ObjectType.BROWSER, desc = "Press Key Up ",input = InputType.YES)
public void KeyUp() {
try {
Page.keyboard().up(Data);
Report.updateTestLog(Action, "Pressed key ["+ Data + "] Up", Status.DONE);
} catch(Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
Report.updateTestLog("Could not perfom ["+Action+"] action", "Error: " + e.getMessage(),Status.FAIL);
}
}
KeyDown
Description: This function is used to press down a key or combination of keys .
Input Format : @Expected Keys or combination. Examples : as stated above.
| ObjectName | Action | Input | Condition | Reference | |
|---|---|---|---|---|---|
| Browser | KeyDown |
@value | PageName | ||
| Browser | KeyDown |
Sheet:Column | PageName | ||
| Browser | KeyDown |
%dynamicVar% | PageName |
Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the data sheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.
@Action(object = ObjectType.BROWSER, desc = "Press Key Down ",input = InputType.YES)
public void KeyDown() {
try {
Page.keyboard().down(Data);
Report.updateTestLog(Action, "Pressed key ["+ Data + "] Down", Status.DONE);
} catch(Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
Report.updateTestLog("Could not perfom ["+Action+"] action", "Error: " + e.getMessage(),Status.FAIL);
}
}
KeyInsertText
Description: This function is used to insert a text via key press .
Input Format : @Expected Keys or combination. Examples : as stated above.
| ObjectName | Action | Input | Condition | Reference | |
|---|---|---|---|---|---|
| Browser | KeyInsertText |
@value | PageName | ||
| Browser | KeyInsertText |
Sheet:Column | PageName | ||
| Browser | KeyInsertText |
%dynamicVar% | PageName |
Inputs in the Input column can be either hardcoded (in this case the data is preceded by a "@"), passed from the data sheet (datasheet name : column name) or passed from a variable value (%variable name%), as given in the above example.
@Action(object = ObjectType.BROWSER, desc = "Insert Text via Keyboard",input = InputType.YES)
public void KeyInsertText() {
try {
Page.keyboard().insertText(Data);
Report.updateTestLog(Action, "Inserted Text ["+ Data + "]", Status.DONE);
} catch(Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, null, e);
Report.updateTestLog("Could not perfom ["+Action+"] action", "Error: " + e.getMessage(),Status.FAIL);
}
}