How to automate upload multiple files using sikuli and selenium webdriver in java -


i new sikuli, unable generate sikuli script upload functionality web application.

please note typically, can automate file upload scenario using selenium only, no need sikuli. uploading file need callsendkeys() method (with file path argument) on webelement displayed file uploading. code goes this:

//put textbox near upload button driver.findelement(by.id("id_or_other_locator_goes_here")).sendkeys("file_path_goes_here"); 

and click upload button:

driver.findelement(by.xpath("locator_for_upload_button")).click(); // click upload button 

sikuli :

i have used sikuli automate file download scenario in ie , below steps this:

  1. first capture image of save button in file download dialog box , save it
  2. put sikuli jar in java project
  3. use following code snippet

// code:

//save file in downloads directory using on sikuli  screenregion s = new desktopscreenregion(); target target = new imagetarget(new file("savedimagepath.png")); screenregion r = s.find(target); mouse mouse = new desktopmouse();    if (r != null) {     mouse.click(r.getcenter());     thread.sleep(5000); } else {     system.out.println("unable click using sikuli") } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -