Forums Register Login

how to perform mouse click action using java.

+Pie Number of slices to send: Send
Hi friends, I'm a unit tester. I want to access install shield using java code like clicking next button(mouse listener) type customized install location (using keyboard listener).I have googled regarding how to perform mouse click for particular button(most probably Next and Cancel button, radio, check box) but I didn't get any idea. please explain me in simple way how to click perticular(next,or cancel)button in install shield using java code. suggestions are highly appreciate. I want to use my own java code to achieve this without using httpunit, or any other framework (Junit,testng). please help me....!
+Pie Number of slices to send: Send
You are going to struggle to do this using Java. There maybe a solution, using the java.awt.Robot class, which allows you to move the mouse to a specific screen location and perform a mouse click but whether this will be passed through to another application or not I don't know. You may have to click twice, once to get focus and once to perform the button click. There is also the problem that you need to know the screen location of the button you want to press.

Personally I'd use an automated GUI testing tool rather than writing my own, there are open source versions available if you don't want to buy one.
+Pie Number of slices to send: Send
Hi Tony, Yep..I'm agree with you. I knew It's a big task to perform with java. I have struggling to innovate this task. My friend suggested me to post my queries in this site. It may help me to get different opinions, different ideas.

Anyhow thank you so much for yours valuable advise...(I'm gathering knowledge on robot java class that you have posted.)

Please help me experts to come out this problem....
+Pie Number of slices to send: Send
This seems like a place you could use the JNI. Unfortuanantly, the downside of WORA is that
Java doesn't always offer complete control over operating system tasks, like moving the mouse,
clicking, etc. This is were calling native code with the JNI comes in, stuff like this can be done in C
easier than in Java.
+Pie Number of slices to send: Send
 

J Coakley wrote:This is were calling native code with the JNI comes in, stuff like this can be done in C
easier than in Java.


Welcome to the ranch.

I agree you could write the code in a native language and interface to it via JNI. I suppose the big question is given the purpose of the app is just to click a button in another app why would you want to do this though via JNI rather just than write the whole program in the native language.

Unless the OP provides more information on what exactly the application is doing and why it has to be written in Java it's hard to give more definitive advice, other than don't do it in Java.
+Pie Number of slices to send: Send
thanks coakley, is it possible to integrate C in java using JNI framework?. Actually yours comment make me sense. if you give me some ideas or flow about the frame that would be more help full to me innovate my task. Regards, Santhosh.
+Pie Number of slices to send: Send
You don't integrate C into Java, you write a C library which you call from Java using JNI. It is not a simple thing to do and it restricts the Java application to whatever platform(s) your native library will support.
+Pie Number of slices to send: Send
oh..thanks tony. is there any other way to achieve this? My objective is wanna perform mouse click() action which we normally do by manually.
+Pie Number of slices to send: Send
 

san thosh wrote:oh..thanks tony. is there any other way to achieve this? My objective is wanna perform mouse click() action which we normally do by manually.


There isn't any other way I know of. Why does it have to be done in Java?
+Pie Number of slices to send: Send
If you're trying to automate the installation of software on Windows, then writing code which will automatically click the installer's buttons is not going to be a solution. That's been the approach of malware writers for a long time and nowadays Windows has security features which prevent that.

If you have a product which is being installed on hundreds of machines and you always click the same buttons, I'd suggest getting the writers of that product to provide you with a "silent" version of the installer which doesn't pester you to click on the buttons.
Yeah, but is it art? What do you think tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2508 times.
Similar Threads
mouseclicked
refer name in HTML for <input type="image"< failed
tracing mouse button click (left-middle-right)
major problem with html:cancel and html:submit
cancel button problem in struts1.1
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:06:29.