Home > Back-end >  Java robot in the Google browser address bar doesn't work
Java robot in the Google browser address bar doesn't work

Time:05-18

The code is as follows:
Public static void main (String [] args) throws InterruptedException, AWTException {
WinDef. The HWND HWND=User32. INSTANCE. FindWindow (null, "a new TAB - Google Chrome");
If (HWND!=null) {
System. The out. Println (" windowTitle="+" foudned ");
If (User32. INSTANCE. SetForegroundWindow (HWND)) {
Robot Robot=new Robot ();
Robot. KeyPress (49);
Robot. The delay (1000);
Robot. KeyRelease (49);

};
}

}
1 cannot be automatically enters the address bar of the browser window, and 360 speed browser is Ok, you can know what reason be? Because chrome what security restrictions?
  • Related