Results 1 to 2 of 2
- 10-18-2009, 08:39 PM #1Member
- Join Date
- Oct 2009
- Rep Power
How can i move the mouse over a html element within web browser?
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
- 10-30-2009, 07:47 AM #2
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.
- By romina in forum AWT / SwingReplies: 2Last Post: 12-09-2010, 04:25 AM
- By ammameiya in forum Advanced JavaReplies: 5Last Post: 06-25-2010, 03:36 AM
- By Lukas in forum Forum LobbyReplies: 0Last Post: 08-06-2009, 11:24 AM
- By the swan in forum AWT / SwingReplies: 2Last Post: 04-04-2009, 05:24 PM
- By surya_dks in forum New To JavaReplies: 2Last Post: 10-04-2008, 08:20 AM