Questions tagged [awtrobot]

The Robot class (java.awt.Robot) is used to programmatically trigger input events such as key press events and mouse actions & can also perform screenshot capture.

The Robot class (java.awt.Robot) is used to programmatically trigger input events, such as key press events and mouse actions & can also perform capture.

For Example:

Example of Java Robot Programming

662 questions
0
votes
1 answer

Robot class, mouseMove in infinite loop

I have a jbutton which I want, as soon as it's clicked to make an infinite loop of a mouseMove by a robot class. Then, to be stopped when it is clicked again. Problem is in my code when I press it for the first time, it causes the system to freeze…
user2276872
0
votes
1 answer

Java Robot won't work when Chrome is in focus

I'm having a weird issue. I'm trying to do some clicking with the robot class in java. All works fine except for when chrome is in focus. This is my method: public static void click(int X, int Y) { PointerInfo info =…
Sorin Grecu
  • 1,036
  • 11
  • 30
0
votes
1 answer

Java: Taking screenshots and making image with separate threads

I am trying to take screenshot with Robot in 1 method and then with another method I am tring to write the BufferedImage produced by Robot without interrupting Robot from capturing screenshots. So far I came up with these: Screenshot…
fs71gh
  • 63
  • 2
  • 7
0
votes
0 answers

VK_F11 key code doesn't switch browser into full screen mode

Using AWT Robot with Selenium WebDriver + Java, I want to switch browser to full screen mode(that we achieve manually using hitting F11 key). Hence, I wrote following code: @Test public void f() throws AWTException, InterruptedException { …
Alpha
  • 13,320
  • 27
  • 96
  • 163
0
votes
2 answers

Threads: Just what is it that makes them confusing? Two Runnables with Mouse Listener

I have a JWindow and a JFrame both I have made runnable and both implement a mouse listener. I have alot of testing to do for a project of mine and to simplify it I wish to be able to automate most of it, so I have starting my own mouse recorder and…
Matt
  • 351
  • 1
  • 5
  • 15
0
votes
4 answers

Writing a method that performs different action each minute

I'm making a program that infinitely clicks on a certain spot. I made those clicks to be random, using the following code: public void leftClick() { int no = random.nextInt(5) + 1; robot.mousePress(InputEvent.BUTTON1_MASK); …
0
votes
2 answers

Throw exception at class level

In my class, I have a method that utilises the awt.Robot class, and I instantiate Robot() every time I run this method. I think this is slowing my processing down significantly though because in cases where the method is run 10000 times in a loop,…
Nathan
  • 1,287
  • 6
  • 15
  • 32
0
votes
2 answers

Selenium Webdriver freezes up while using Java's Robot class

I am working on an automated test that needs to open a document in Internet Explorer. The script works perfectly fine until after clicking a link to the document, which launches the pesky IE popup window like below Since I am not able to focus on…
Jason
  • 1,371
  • 4
  • 21
  • 44
0
votes
1 answer

RGB integer to Color object

I am drawing an integer from a Color using this code: robot.getPixelColor(x, y).getRGB() Now how do I go from an integer back to an RGB color? I've looked about and I havn't seen anything that does this... Thanks!
Nathan
  • 1,287
  • 6
  • 15
  • 32
0
votes
2 answers

Is there a way to stop the Robot class after it has started

Is there a way to stop Java Robot execution once it's started? I have a program that simulates left mouse button clicks, but i also have an unused JButton named STOP that was supposed to stop this clicking that i started using the Robot class. I…
bltzrrr
  • 789
  • 1
  • 8
  • 14
0
votes
1 answer

char to KeyEvent int

Looking to translate a character into an integer for use with awt robots key controls. I have this solution which works right now but its long, messy, and I'll need to add every single possible key that could be entered, which is a lot. Is there a…
Nathan
  • 1,287
  • 6
  • 15
  • 32
0
votes
4 answers

How do you simulate a click on a JTextField? Equivalent of JButton doClick()?

I am working on a Java project and need to have a keypress simulate a click on a JTextField. What I'm looking for is the equivalent of the JButton doClick() method. I am trying to have the keypress "enter" perform the exact same function as a click…
Vox
  • 161
  • 2
  • 9
0
votes
1 answer

Java Stress Testing Automation for a Web Application

As what the title say, I would like to create a Java application that will automate a stress testing in a specific Web Application of mine. I am looking to use Robot Class. I have not begun the coding just yet, still researching for the mean time on…
oneofakind
  • 552
  • 17
  • 41
0
votes
1 answer

Ctrl+C on Java robot is not working

I am trying to write a code using Java robot that will copy text using ctrl+c, and then I read it from the clipboard. The code I used is this: Robot robot = new…
user3503734
  • 1
  • 1
  • 1
0
votes
1 answer

HeadlessException with java.awt.Robot with Jenkins on a Mac Mini

We've a Mac Mini that does some automated testing from a brew Jenkins install, on a Mac Mini in our office, which we're using a test tool called "Genie", which at it's lower level, creates a java.awt.Robot, but at sun.awt.HToolkit.createRobot, a…
seaders
  • 3,878
  • 3
  • 40
  • 64