【发布时间】:2013-04-03 04:06:39
【问题描述】:
我的代码如下,我正在使用 Mac 执行脚本并运行 2 个节点,1 个在 windows 上,1 个在 mac 本身上。 Mac上的上传完美,但windows上传不起作用。
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection str = new StringSelection("C:\\Sheyan.pdf");
clipboard.setContents(str, str);
if (systemType=="http://192.168.1.100:5555/wd/hub") **(THIS IS THE WINDOWSOS NODE)**
{
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
}
else **(FOR MAC OS NODE)**
{
selenium.click(driver, UploadButton);
WebElement fileInput = driver.findElement(UploadButton);
fileInput.sendKeys("/Users/accesstesting/Documents/Sheyan.pdf");
}
【问题讨论】:
-
你是从 MAC 机器上运行脚本吗,网格和节点在哪里运行?
标签: file-upload automation selenium-webdriver selenium-grid