0
我需要点击下面的网页上的“浏览”按钮。无法点击使用硒webdriver“浏览”按钮
http://www.guru99.com/freelancing.html
我已经写了下面的代码,但webdriver的未能找到浏览按钮元素。请帮忙。
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FileUpload {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.gecko.driver", "C:\\Eclipse\\Drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.guru99.com/freelancing.html");
driver.findElement(By.id("theFile_link(Resume)")).click();
//Below line execute the AutoIT script
Runtime.getRuntime().exec(System.getProperty("user.dir")+"\\FileUpload.exe");
driver.close();
}
}
我使用:
的Firefox版本: 49.0.1
硒版本:版本3.0.0-BETA4
OS: Win10 64位
的Java: 1.8
使用异常日志更新您的故障单。另外,让我们知道你为什么试图点击该按钮并执行'AutoIT'脚本,而不是发送路径到文件''输入[@ id =“theFile_property(Resume)_1”]' – Andersson
您能否在这里分享相关的HTML好 –