Выделение текста в режиме эмуляции событий не работает.
Этот код выделит только нужный текст: "Автор: Игорь на 20:11 Комментариев нет:"
Используется полная эмуляция мыши.
$browser->navigate("http://humanemulator.blogspot.com/");
$browser->wait_for(60,1);
$obj = $div->get_by_attribute("class","post-footer-line post-footer-line-1", true);
$obj->scroll_to_view(false);
$x = $obj->get_x (false);
$y = $obj->get_y (false);
$width = $obj->get_width (false);
$height = $obj->get_height (false);
// начальная точка
$dx = $x - rand(2,5);
$dy = $y - rand(2,5);
// конечная точка
$x_end = $x + $width - rand(1,3);
$y_end = $y + $height - rand(1,3);
$mouse->move_to($dx, $dy, "curve", rand(500,1000));
sleep(rand(1,3));
//зажать левую клавишу мыши в начале текста
$mouse->left_button_down( $dx, $dy);
$step_x=($x_end-$dx)/10.0;
$step_y=($y_end-$dy)/10.0;
for ($i=0;$i<=10;$i++)
{
$mouse->move( $dx+$i*$step_x, $dy+$i*$step_y);
usleep(25000);
}
// отпустить в конце текста
$mouse->left_button_up($x_end, $y_end);
выделит непонятно что, хотя координаты те же.
Проблема возникает из-за send_move
скрин -
http://prntscr.com/r2hwve
$browser->navigate("http://humanemulator.blogspot.com/");
$browser->wait_for(60,1);
$obj = $div->get_by_attribute("class","post-footer-line post-footer-line-1", true);
$obj->scroll_to_view(false);
$x = $obj->get_x (false);
$y = $obj->get_y (false);
$width = $obj->get_width (false);
$height = $obj->get_height (false);
// начальная точка
$dx = $x - rand(2,5);
$dy = $y - rand(2,5);
// конечная точка
$x_end = $x + $width - rand(1,3);
$y_end = $y + $height - rand(1,3);
$mouse->send_move_to($dx, $dy, "curve", rand(500,1000));
sleep(rand(1,3));
//зажать левую клавишу мыши в начале текста
$mouse->send_left_button_down( $dx, $dy);
$step_x=($x_end-$dx)/10.0;
$step_y=($y_end-$dy)/10.0;
for ($i=0;$i<=10;$i++)
{
$mouse->send_move( $dx+$i*$step_x, $dy+$i*$step_y,false,0,0,"LeftMouseButton");
usleep(25000);
}
// отпустить в конце текста
$mouse->send_left_button_up($x_end, $y_end);
Исправьте пожалуйста.