java - Select different file in file browse window during rumtime -
i using selenium web driver deal file browse window. after trying different things find solution using 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); { 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(); }
script autoit follow has generate upload.exe file, , have given in path name
winwaitactive("file upload") send("[kickass.to]desi.kattey.2014.1cd.dvdscr.rip.hindi.xvid.mp3.mafiaking.teamtnt.exclusive.torrent") send("{enter}")
here takes single file every time run this. how take different files.
autoit script has provision pass parameters command line. when using runtime.exec("process")
execute autoit script, @ point of time pass file name argument , take command line argument in script. allow me know if helps.
java selenium
No comments:
Post a Comment