support for mouse up and down functions
This commit is contained in:
parent
d8b2f05767
commit
7ac8a2f7c2
2 changed files with 35 additions and 0 deletions
|
@ -53,6 +53,18 @@ function leftclick($main, $control, $options) : bool
|
|||
return true;
|
||||
}
|
||||
|
||||
function leftpress($main, $control, $options) : bool
|
||||
{
|
||||
$control->mouseDown(\ScriptedBrowser\MouseButton::Left);
|
||||
return true;
|
||||
}
|
||||
|
||||
function leftrelease($main, $control, $options) : bool
|
||||
{
|
||||
$control->mouseUp(\ScriptedBrowser\MouseButton::Left);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* move mouse to given element
|
||||
*
|
||||
|
|
|
@ -194,6 +194,18 @@ class Control
|
|||
{
|
||||
fwrite($this->xdotool, "key $key\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* press mouse button
|
||||
*
|
||||
* @param MouseButton $button button to press
|
||||
* @return void
|
||||
*/
|
||||
public function mouseDown($button)
|
||||
{
|
||||
fwrite($this->xdotool, 'mousedown ' . $button->value . "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* move mouse to absolute position
|
||||
*
|
||||
|
@ -217,6 +229,17 @@ class Control
|
|||
fwrite($this->xdotool, "mousemove_relative $x $y\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* release mouse button
|
||||
*
|
||||
* @param MouseButton $button button to press
|
||||
* @return void
|
||||
*/
|
||||
public function mouseUp($button)
|
||||
{
|
||||
fwrite($this->xdotool, 'mouseup ' . $button->value . "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* open geckodriver if not already running
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue