Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do we hava any core java API which simulates left mouse click and release?

 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could you please give me the name of the API if any?
 
Sumit Patil
Ranch Hand
Posts: 296
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its SwingUtilities class

Check this
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15367
40
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the java.awt.Robot class will be useful for this.
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sumit Patil wrote:Its SwingUtilities class

Check this


That isn't a method that
simulates left mouse click and release
 
Maneesh Godbole
Saloon Keeper
Posts: 11070
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically speaking, a "click" is a press+release.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also create a new MouseEvent and post it to the system EventQueue manually.
To simulate a user clicking a mouse button you'd need to post two such events (MOUSE_PRESSED and MOUSE_PRESSED).
The java.awt.Robot class Jesper suggested would probably be a better option, though.
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to do the mouse click and release in HTML5 canvas. i am trying to do selenium automation.
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
linda russel wrote:i am trying to do the mouse click and release in HTML5 canvas. i am trying to do selenium automation.

Selenium.click, .mouseDown, .mouseUp, etc. etc. -- these are insufficient for your test case?
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem is i am getting the id of the html5 canvas. but i do not know how to get a particular co-ordinates and do the processing there.
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


my smiley is not being drawn inspite of the following code!!! any ideas?
 
linda russel
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator





The first part of the code is written as a method in a common java file
The second part of the code is written as a call to that common method.
Ispite of these smiley is not drawn ?
Any idea of how to correct it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic