added functionality for key presses

develop
Sascha Nitsch 2024-09-09 16:38:49 +02:00
parent 76e7826b60
commit fb5054c7f7
2 changed files with 25 additions and 0 deletions

View File

@ -23,6 +23,21 @@ function injectjscript($main, $control, $options)
return true;
}
/**
* press given key
*
* @param \ScriptedBrowser\Main $main
* @param \ScriptedBrowser\Control $control
* @param array<string,mixed> $options options
* @return bool always true
*/
function key($main, $control, $options)
{
$key = $main->vars($options['parameter']);
$control->key($key);
return true;
}
/**
* do mouse left click
*

View File

@ -184,6 +184,16 @@ class Control
return $this->executeScript('return [window.pageXOffset, window.pageYOffset];');
}
/**
* press given key (combination)
*
* @param string $key key to press
* @return void
*/
public function key($key)
{
fwrite($this->xdotool, "key $key\n");
}
/**
* move mouse to absolute position
*