代碼如下:
public static void main(String[] args) throws InterruptedException, AWTException {
WinDef.HWND hwnd = User32.INSTANCE.FindWindow(null, "新標簽頁 - Google Chrome");
if (hwnd != null){
System.out.println("windowTitle=" + "foudned");
if (User32.INSTANCE.SetForegroundWindow(hwnd)){
Robot robot = new Robot();
robot.keyPress(49);
robot.delay(1000);
robot.keyRelease(49);
};
}
}
瀏覽器視窗的地址欄無法自動輸入1,而360極速瀏覽器是Ok,各位大俠知道是什么原因嗎?是因為chrome有什么安全限制嗎?
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/284263.html
標籤:Java相關
上一篇:解憂
下一篇:這個應該怎么寫啊?求解
