The tools I am currently using are Protractor 3.3.0, Jasmine 2.4.1, and Selenium Standalone Server.
My main objective is to create a test scenario where the test navigates to a specific page and then clicks on an 'upload file' button. This action triggers the File Upload Window similar to Windows Explorer. The challenge lies in determining if it's possible to interact with this window using JavaScript within the context of Protractor and Jasmine.
In a past project, I was able to achieve a similar task using Java. In that case, I found all windows, selected the top one from the stack, used keyboard inputs to navigate to the input field, pasted the file path from the clipboard, and finally submitted the form by pressing enter.
However, I am facing some difficulties with this approach as the find all windows method only detects the current browser window and not the upload file window itself.
I am aware that there is a java import option for utilizing JavaScript through npm, but I encountered some challenges in implementing it immediately. Ideally, I would prefer to work directly within the Protractor/Jasmine environment without having to rely heavily on additional libraries. Nevertheless, if that turns out to be my only feasible solution, I am willing to explore further options.
There is also the possibility of injecting the file path via HTML:
$('input[type="file"]'.sendKeys(filePath);
. However, since I aim to simulate user actions accurately, I believe accessing the Upload Window and interacting with it directly would provide a more comprehensive testing scenario.
I welcome any thoughts or suggestions you might have on this matter. Your insights would be highly valuable at this stage of development.