How to automate with pictures

Asked by Francisco

Hello,

First of all, great job, really like it!
I am making an application to make automatic testing, using Selenium. In my app, you can click, type, and do other things with the elements on the web by using its id. However, when i have, for example, a webpage where you want to import a file from your computer, usually what happens is that you have a Browse button and when you click it a Windows pop-up opens for you to search for the file and import it. I'm having a problem with this, because my app can't detect anything from the Windows pop-up, only from the web. I think this problem could be solved by using something with images like you did here, that's why i was wondering if you could tell me more about how you did this in order for it to work.
Any help would be appreciated :).

Thank you.

Regards.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Francisco
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi,

Yes, windows pop-ups are a problem for Selenium. It can't handle them as they are not a part of the browser which Selenium interacts with. There is a way however to make it work in many case. You just have to find an element and type in the path of the file you want to attach. Not sure what language you are using but Java example is:

WebElement upload = driver.findElement(By.id("myfile"));
upload.sendKeys("/Path/dir1/dir2/fileToAttach.jpg");
driver.findElement(By.id("submit")).click();

If there is no way to do that with pure Selenium then yes, you can use Sikuli to solve that problem. To give a specific example however, more details are needed. For example, what language you are using.

In any case, that is a very basic Sikuli task and I am sure you will quickly get the idea from briefly viewing the documentation on Sikuli website.

Cheers,
Eugene

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Just start here:
http://sikulix.com

... have a look into the docs and some basic examples (tons in the net)

Depending on what you use with Selenium (Java, Python, ...) you should setup some basic SikuliX playground and find out what is possible.

Come back with concrete question.

... and yes, SikuliX can ;-)

Revision history for this message
Francisco (fgmaltez) said :
#3

Thank you for the ideas!
Meanwhile i've been reading some of your docs and i think i got it. Thanks for the help :)

Regards,
Francisco