大家好,我有一個關於文件上傳的問題。webdriver如何關注文件上傳窗口當窗口最小化或最大化窗口
我使用pc A遠程登錄pc B; PS:pc B有eclipse和webdriver代碼;
我最大化了遠程窗口(PC B),文件上傳窗口可以關注。當我
最小化或關閉遠程窗口(PC B),文件上傳風不能上。
這是我的代碼。
CommonAction.findElement(driver, "SWFUpload_0", "id").click();
setClipboardData(fileUrl);
Robot robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_N);
robot.keyRelease(KeyEvent.VK_ALT);
robot.keyRelease(KeyEvent.VK_N);
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
使用
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_N);
不工作,不能集中文件上傳窗口。
硒版本:2.27 OS:風7 瀏覽器:鉻 瀏覽器版本:26
感謝所有
謝謝你的回覆,我會試試看 – janice