Results 1 to 2 of 2
  1. #1
    bobomonkey is offline Member
    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Default How can i move the mouse over a html element within web browser?

    Hi,

    I am writing a functional test automation script to automate the file upload feature of a web application. I am using a tool called selenium to operate on the browser. This tool however does not support clicking on the file upload control hence I want to do this operation using java robot.

    First I need to move the mouse pointer onto the html element (file upload control) displayed within a html page. I believe to do that i need to get the coordinates of the html element. I tried with the offsetLeft and offsetTop but those are just the relative coordinates (relative to the html document). I need the absolute screen coordinates. Is there a way to get the absolute screen coordinates? If not can you suggest a different approach?

    Thanks for reading

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    my first thought was you can't move the mouse cursor from a java application,
    however, it likely could be possible to create a kind of custom vnc viewer client,. where by the host doing the test runs a vnc serer, and your java test automation script implements a stripped down vnc viewer client, such as one that is written in java (tightvnc has one). there is a lot of nitty gritty details in the RFB protocol, but certianly you could jerry rig something that connects a client to the local host and doesn't open a display, and just invokes the mouse move position messages to the vncserver, moving the mouse to the button to be tested.
    other similar ideas, projects like X2vnc, win2vnc where a network client on your machine can drive the keyboard and mouse on a second or more computer running vnc, such as if it was beside you and you wanted to have one control for more than one desktop.
    another project i know of that does this kind of keyboard mouse control is synergy.
    the trick is, to find some kind of network based remote control software, and have a java client communicate in that network protocol, and instead of showing the remote desktop display, or having the host's keyboard and mouse move the controlled system, it would just move teh mouse according to a trained test plan.

Similar Threads

  1. Help with Move Shape
    By romina in forum AWT / Swing
    Replies: 2
    Last Post: 12-09-2010, 03:25 AM
  2. How to print a HTML file in browser look using JAVA
    By ammameiya in forum Advanced Java
    Replies: 5
    Last Post: 06-25-2010, 02:36 AM
  3. Move thread
    By Lukas in forum Forum Lobby
    Replies: 0
    Last Post: 08-06-2009, 10:24 AM
  4. how can i move from Frame to another
    By the swan in forum AWT / Swing
    Replies: 2
    Last Post: 04-04-2009, 04:24 PM
  5. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •