How do I simulate a click with coordinates on HtmlPage
then get the result a HtmlPage
?
I want to click a button without an id or a name
I'm using the library com.gargoylesoftware.htmlunit
How do I simulate a click with coordinates on HtmlPage
then get the result a HtmlPage
?
I want to click a button without an id or a name
I'm using the library com.gargoylesoftware.htmlunit
not sure about specific system or browser settings, but in general you can do this by following:
import java.awt.event.*;
import java.awt.Robot;
public class test {
int xparam=50;
int yparam=100;
public static void main(String args[]) {
Robot mybot = null;
try {
mybot = new Robot();
} catch (Exception failed) {
System.err.println("Failed instant. Robot: " + failed);
}
int maske = InputEvent.BUTTON1_DOWN_MASK;
mybot.mouseMove(xparam,yparam);
mybot.mousePress(maske);
mybot.mouseRelease(maske);
}
}
For a smoother solution take a look at this ;
No,You can't click button with coordinates(X,Y). Please specify the element other attributes because it can be click with help of other attribute