2017-09-18 68 views
1

这是链接:“https://uploadfiles.io/” 在此链接上我想上传文件。因为我将运行Selenium,所以不能使用AutoIT和sikuli。所以必须使用selenium的setFileDetector方法。但是我怎么能在本地上传一个文件,因为如果你检查上面的链接的HTML,就没有输入字段。如何在Selenium Grid上没有输入字段时使用Selenium上传文件

+0

可以使用机器人类。可能重复的https://stackoverflow.com/questions/45711632/how-to-select-file-in-selenium-webdriver-from-local-machine-from-window-popup-wi和https://stackoverflow.com /问题/ 16896685 /如何到使用 - 硒的webdriver-在-java的上传文件, – swati

回答

0

可以combine Sikuli and Selenium(或硒和Kantu file uploads

// Create a new instance of the Firefox driver 
WebDriver driver = new FirefoxDriver(); 
// And now use this to visit Google 
driver.get("http://www.google.com"); 
//Create and initialize an instance of Screen object 
Screen screen = new Screen(); 
//Add image path 
Pattern image = new Pattern("C:\\searchButton.png"); 
相关问题