0
我正在使用Selenium網絡驅動程序,我要處理文件瀏覽窗口。在嘗試不同的事情後,終於找到了解決方案,我使用AutoIt。運行期間在文件瀏覽窗口中選擇不同的文件
Script是
@Test
public void test() throws InterruptedException, IOException
{
driver.manage().window().maximize();
Thread.sleep(1500);
driver.findElement(By.xpath("//div[@id='input-file-wrapper']")).click();
Thread.sleep(1000);
Process proc =Runtime.getRuntime().exec("D:\\Upload.exe");
driver.findElement(By.xpath("//div[@id='go-btn']")).click();
//driver.findElement(By.name("File name")).sendKeys("D:\\[Limetorrents.cc]_Daawat e Ishq (2014) DvDScr x264 [DTRC] .torrent");
driver.findElement(By.xpath("//div[@id='cloud-free-btn']")).click();
/*
WebDriverWait wait=new WebDriverWait(driver,50);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='vlc- playlist']")));
*/
Thread.sleep(1000);
// String i= driver.findElement(By.xpath("//div[@class='seed-number']")).getText();
boolean i1=driver.findElement(By.xpath("//div[@class='vlc-playlist']")).isDisplayed();
System.out.println(i1);
do
{
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
i1=driver.findElement(By.xpath("//div[@class='vlc-playlist']")).isDisplayed();
}
while(i1!=true);
Thread.sleep(1000);
driver.findElement(By.xpath("//img[@alt='trash']")).click();
driver.findElement(By.xpath("//div[@class='confirm-to-remove']")).click();
}
的腳本AutoIt的是跟隨它具有產生Upload.exe文件,我在路徑名
WinWaitActive("File Upload")
Send("[kickass.to]desi.kattey.2014.1cd.dvdscr.rip.hindi.xvid.mp3.mafiaking.teamtnt.exclusive.torrent")
Send("{ENTER}")
這裏給只需要每次單個文件我運行這個。如何拍攝不同的檔案。