Send Mouse Click to WebEngineView



  • I am making a WebAutomation tool,I would like to know how I could send mouse events to the WebEngineView.
    Here are some things I have tried but haven't work.

    event= createMouseEvent(QEvent::MouseButtonPress, QPoint(mouse_x,mouse_y), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
    QApplication::instance()->sendEvent(view,event);
    

    and

    QTestEventList eventos;
    eventos.addMouseClick(Qt::LeftButton, 0, QPoint(mouse_x,mouse_y), -1);
        eventos.simulate(view);
    

    where view is a QWebEngine View.
    I know that one can use javascript methods for clicking .But i would like to provide the user with a method of using mouse coordinates instead.

    i would prefer a solution thats cross platform and can work when the window is minimised or not in view.

    A noob friendly explanation will be greatly apprecieated.
    Please help.
    Thanks in advance.



  • You can try the suggested solution here


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.