mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Implement performKeys function to handle key actions
Replaced the deprecated driver.sendKeys() method with a new helper function that uses the deprecated method due to WinAppDriver limitations.
This commit is contained in:
@@ -28,24 +28,10 @@ async function executeCommand(command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEW: Helper function replacing the deprecated driver.sendKeys()
|
|
||||||
async function performKeys(driver, keysArray) {
|
async function performKeys(driver, keysArray) {
|
||||||
const actions = [];
|
// WinAppDriver doesn't support W3C Actions for keys.
|
||||||
|
// We are forced to use the deprecated method.
|
||||||
// Map every key stroke to a sequential down/up action
|
await driver.sendKeys(keysArray);
|
||||||
for (const key of keysArray) {
|
|
||||||
actions.push({ type: 'keyDown', value: key });
|
|
||||||
actions.push({ type: 'keyUp', value: key });
|
|
||||||
}
|
|
||||||
|
|
||||||
await driver.performActions([{
|
|
||||||
type: 'key',
|
|
||||||
id: 'keyboard',
|
|
||||||
actions: actions
|
|
||||||
}]);
|
|
||||||
|
|
||||||
// Release actions state so modifier keys don't accidentally stick
|
|
||||||
await driver.releaseActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runSSD() {
|
async function runSSD() {
|
||||||
|
|||||||
Reference in New Issue
Block a user