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:
- first capture image of save button in file download dialog box , save it
- put sikuli jar in java project
- 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
Post a Comment