support for mouse up and down functions
parent
d8b2f05767
commit
7ac8a2f7c2
|
@ -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 New Issue