Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
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?
 
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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the java.awt.Robot class will be useful for this.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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

 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically speaking, a "click" is a press+release.
 
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.
 
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?
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!