Reputation: 1
I try to upload a file in ProTractor to the application, which is developed in Angular with Electron.
To do it manually I need to click on the "Browse" button and then select a file in the windows dialog "Open".
I managed already the part for providing of the path to the file and click on "Open" button on the dialog by using of AutoIt
var autoIt = require('autoit');
autoIt.Init();
autoIt.WinActivate("Open");
autoIt.WinWait("Open");
autoIt.ControlSetText("Open", "", "1148", appPath);
autoIt.ControlClick("Open", "", "1");
But this part of the code will be not executed after click on the "Browse" button
element(by.id('browseText')).click();
I guess that ProTractor waits for angular or for page loading, but because after clicking on the button the windows dialog is opened, the execution of further code is blocked. Also afterward I couldn't just output something in the console.
Is there an option to disable wait for page loading and to perform the action immediately after the click?
Unfortunately, the disabling of waiting for Angular didn't help as well as synchronization ignoring
browser.waitForAngularEnabled(false);
browser.ignoreSynchronization = true;
Thank you in advance for your support.
UPDATED
The problem is in the timing because when I try to execute the small following code
browser.waitForAngularEnabled(false);
element(by.id('browseText')).click()
.then(function () {
console.log("clicked");
});
browser.sleep(5000)
.then(function () {
console.log("5 sec are over!");
}); // wait 5 sec
browser.sleep(3000);
console.log("End");
The following happens:
Here is the output of this code:
[09:37:14] I/launcher - Running 1 instances of WebDriver
[09:37:14] I/direct - Using ChromeDriver directly...
..End
..F
Failures:
1) Scenario: Add an application # features\tst_General.feature:10
V Before # features\steps\DataGrid.js:20
V Before # features\steps\General.js:25
V When The "bounce" application has been added # features\steps\General.js:65
V After # features\steps\General.js:29
× After # node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:2
5
Error: function timed out, ensure the promise resolves within 90000 milli
seconds
at Timeout._onTimeout (C:\Users\10050296\Documents\workspace\sm-protr
actor-automation\node_modules\cucumber\src\user_code_runner.js:61:18)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
1 scenario (1 failed)
1 step (1 passed)
1m30.217s
Upvotes: 0
Views: 1322
Reputation: 1643
Let's be clear. This is work 100%:
browser.waitForAngularEnabled(false);
Protractor part, as I understand, also work. The Browser
button is clicked.
So, the issue in the Autoit
part. The question is - "How to run Autoit?"
Just add sleep
to check is it waiting
problem on the Autoit
side:
element(by.id('browseText')).click();
browser.sleep(5000); // wait 5 sec
...
autoit code
...
If it works, so the issue in Autoit
waiting.
Upvotes: 0