1

This question already has an answer here:

I am new to selenium. I want to replicate a scenario in which User clicks on 'Choose file' and then uploads an excel file lying on the same desktop and then clicks on submit.

I have tried using sikuli and added the below mentioned lines for file upload in the code:

    Pattern name = new Pattern("C:\\Users\\delhivery\\Desktop\\Selenium Class\\name.png");
    Pattern open = new Pattern("C:\\Users\\delhivery\\Desktop\\Selenium Class\\open.png");      
    Screen.src = new Screen();
    src.setAutoWaitTimeout(30);
    src.type(name, "C:\\Users\\delhivery\\Desktop\\Express CSV Files\\DataE.xlsx");
    src.click(open);

But still it shows errors. I have added the Sikuli Jar file as well in the project. Do I need to import something as well?

Step by step detailed instructions would be great, Thanks!

marked as duplicate by Niels van Reijmersdal, IAmMilinPatel, ECiurleo, NarendraC, Kate Paulk Sep 26 '16 at 11:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Why do yo re-use a question to ask something new? I understand it is related, but its a new question. Namely Sikuli gives errors. Also you did not include the error. – Niels van Reijmersdal Sep 27 '16 at 10:03
  • The linked page does not suggest to use Sikuli to handle this, although it should work, i think it is the worst pick of the possible solutions. Mainly because its not cross-platform and it might break with Operating System updates, because the style might change slightly, meaning you need to update the images. – Niels van Reijmersdal Sep 27 '16 at 10:05