added functionality for key presses
parent
76e7826b60
commit
fb5054c7f7
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue