Protractor: Unable to handle windows Based popup to browse and upload a file using Protractor framework - protractor

Trying to automate uploading .xml/pdf format files (Windows based popup) from local system to web application (Angualrjs) using Protractor framework.
Scenario:
Browser the application in Chrome> Click upload button> web app popup comes where able to locate elements > click Browse button on upload field (This field would be disabled, only click event is allowed which opens windows popup to browse files)> Here we have challenge to browse the file.
After clicking Browse button performed> Window popup shows Documents location however we want to browse and upload the file from Desktop or from Project location.
Followed other stackoverflow references as given below but unable to solve:
How to upload file in angularjs e2e protractor testing
Scripts which we tried:
iUploadConfigDefinition : (sPath) => {
var absolutePath = path.resolve(__dirname, sPath);
uploadInput.sendKeys(absolutePath);
}
Here not sure what should be 'uploadInput' element locator and how to recognize/fetch Open button of windows popup.
Please guide. Attached the screen for reference.
enter image description here

Please try the following solution :
browser.findElement(by.xpath("path of the browse button"));
browser.findElement(by.css('input[type=file]')).sendKeys('full path of the file with extension');

Related

Not able to use "Continue Here" button in WOPI Client

When clicking Open in Desktop App in WOPI client, the document opens in the Office desktop app. And in the same WOPI client, it shows a popup having Continue here button which can be used to reload the document once editing is done in the desktop office app.
For PPTX, clicking Continue here button is working fine. But for XLSX and DOCX files it is throwing an error in the browser console.
Can anyone suggest where I should check?

Protractor load testing browser tab not working properly

I am trying to do load testing but facing some issues. Scenario below
open webapp localhost:2244
click drop down
Select a profile from drop down.
on click on profile aggrid is populated from server
In the code i have following
browser.get(url)
element(by(<drop down>)).click()
element(by(<profile>)).click()
browser.driver.sleep(4000) //wait for aggrid to populate from server
The problem i am facing are
when i open url only once it works fine but when i open the same url multple times in a loop it doesn't open in different tab and the same tab gets updated. i tried to open in multiple tabs but only one tab opens properly and other remains empty.
How can i concurrently open 1000s or url as if many different users are opening the url and keep track of each page seperately and verify aggrid.

How do I trigger the 'Add to homescreen' prompt for a PWA?

I have a PWA setup with a manifest and service worker such that I can manually add to the homescreen on Chrome in Android if I select the 'add to homescreen' button under the menu. I also verified on the Desktop that I can add it as a webapp in Chrome.
However, it seems that the installation banner only pops up based on some heuristics that Google selects e.g. user must interact with the site for 30 seconds etc.
What I would like is a button on my homepage, such that when I trigger it, the add to homescreen banner will automatically pop up in Chrome. How do I do this?
I want something similar to the 'Install' button on this example site: http://airhorner.com, which manually triggers the banner. However, what I would like is a minimal working example that demonstrates this.
The first thing to check is with the Chrome Audit tools.
Run the Progressive Web App audit
Under Passed Audits, you should see
--- "User can be prompted to Install the Web App"
Notes I have for A2HS
Source code links there for my working example
https://ng-chicago.github.io/2018/06/18/add-2-home-screen/
There are also reference articles I used
Most of the work when testing your A2HS is constantly clearing out your browser and previous installs (Chrome desktop and mobile) to test again.

Redirect link in Ionic text field not opening in browser

I have an app containing multiple editable forms.
In all of them there is a URL field. I want this to open that URL in a browser window. Unfortunately at present it opens with my sites URL prepended before it.
ie If someone enters www.othersite.com and my site URL is www.mysite.com, clicking on the link will open www.mysite.com/www.othersite.com
How do I get the app to open www.othersite.com instead?
Try this way
Add Cordova Inappbrowser plugin and try
var ref = cordova.InAppBrowser.open('http://www.othersite.com', '_blank', 'location=yes');
or
window.open('www.othersite.com','_system','location=no');

Phone gap ios app - show pdf file with print/email options

I have a requirement to do the following task.
Inside a Phonegap iOS app, the user wants to view a pdf file after clicking a link which will load the pdf from the remote server.
And also user needs print, email functions with this document viewer.
So far I have tried following options.
Exit from the app when user click on the link and try to load the pdf throught the Safari. This is not working because user has to relogin for viewing the application.
Check with child-browser plugin. But it does not provide the options like print/email.
It'll be really great if some one can help on this who has similar experience.
Thanks