Open a PDF file from a WinJS Application - pdf

I've got an application in which the user clicks a button, and should be presented a PDF that is stored in the application.
They can view the PDF internally in the app, or launch the native windows PDF viewer, either way is fine.
How can I provide a link / event handler for the button click to launch a view of a PDF file?

Use the LaunchFileAsync function of the Launcher class,
description: Starts the default app associated with the specified file, using the specified options.
example code:
Windows.System.Launcher.launchFileAsync(file, options).done( /* Your success and error handlers */ );

Related

Capture objects which are pops up from web page - Automation Anywhere

I just need to click on "OK" , the pop up generated by web page , i m not able to perform click operation on pop-up generated by web page in Automation Anywhere
enter image description here
Normally the object Cloning command works on that type of windows, you just need to put the main window of the object cloning as "Message from webpage" instead of the main webpage.
If not Image recognition shpuld work perfectly
You can use selenium. use find_by to locate the popup element.
close_button = driver.find_elements_by_class_name("popover-x-button-close")[0]
close_button.click()
sum_div.click()
driver.implicitly_wait(2)

How to load images via file open dialog in TestCafe

Background info:
Our application depends on different sets of medical images (due to the medical environment we can't share our code). In each image, a set of test cases is run. Each time we need to manually select a new image, which of course we want to automate. The loading of images is fairly complex, but our devs created a button that covers all that. This button opens a File open dialog.
My Question:
How can I open a file dialog window and import new images with TestCafe?
We've tried:
t.setFilesToUpload (which not seems to work because it needs a selector where the images get uploaded to?)
List item clicking the button (it does not open the dialog
window)

Can I make popup screen or file upload automatically with selenium?

Good morning. I have a web page control with selenium. However, when I click the button of the site, a pop-up screen appears and I want to test that the file attachment is saved by pressing the file attachment button in it. Can you control selenium with two windows (parent, child-popup) going up and down?
I guess you want to interact with file upload dialog which is native window via selenium. That is not possible. However you can select file to upload using sendKeys without the dialog being opened.
Something like that
fileInput.sendKeys("/path/to/local/file");

Selenium Upload a file using button type and button tag instead of file

I have a webpage where I click on a button and an open dialog it's opened and I should select the file to upload. After that, a pop up is displayed saying OK or KO.
I'm able to upload files when the there are files types. But in this case, the element where I click it's:
<
button type="button" read-file="_.partial(submitLang, selectedLang)" id="import-lang" class="btn btn-default"><
/button>
For the rest of the application, I use this and it works:
WebElement element = getPage().findElementById(id);
element.sendKeys(absoluteFile);
But for button types and button tag it doesn't work.
How can I do it? The tests are running on a Linux machine
Thanks a lot!
More info!!
Hi all,
The whole process is: (see image at http://imageshack.com/a/img540/6237/JoTQng.png)
Click on Import button
A dialog is opened and I select a .json file and click Open
An alert is displayed saying "Text properties have been updated".
We are using angular for the frontend and all are REST calls.
We don't have any "file=type". All three are buttons. You can found more code at
http://imageshack.com/a/img633/7299/BQhP7o.png
For a file upload with selenium, you need to find an input tag with the type "file".
Have a look at your HTML and search for it.
When you found it, the rest is pretty straightforward:
Let's say this input-element has id="import"
driver.findElement(By.id("import")).sendKeys(absoluteFile);
If you run into problems, please post more of your HTML, then I can have a look at it.
In my case, clicking on the button made an element appear in the HTML code, I assume due to javascript.
I clicked on the element (which both opens a file upload window and adds the to the HTML), and immediately after send the keys to the input element.
This creates the problem of having to close the newly opened file upload window, however this is not a problem when using --headless mode on google chrome.
I do not have a solution to close this window if you are not in headless mode for your chosen browser.

Can I create Windows screen saver with Adobe AIR?

Is it technically possible to create a screen saver for Windows using Adobe AIR?
A work around is to host a .swf within a Windows form exe. I currently do this with C#/.Net 4.0. First you need to configure the .exe to behave as a screensaver. When you are done, you need to rename your .exe to .scr. Within the windows form, you need to embed a Flash Active X Object, then set the windows form to borderless etc.
If needed, the .swf can communicate to the .scr via the fscommand call. I for example, listen for the mouseMove event, within the .swf, then tell the .scr to close via fscommand.
There is a free utility that converts .swf files to screensavers called InstantStorm, but I personally prefer the Windows form method, as it allows more control.
Embedding the flash object
Windows form to screensaver
Yes it is.
What you can do is compile your AIR project with -captive-runtime OR -target bundle (Makes it a standalone .exe instead of .air file).
For windows, simply rename your .exe to .scr, right click and choose install or test.
If you want to set it up for configuration and preview modes, you can listen for the application invoke event:
//put this in your app main constructor
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, invokEventHandler, false, 0, true);
protected function invokEventHandler(e:InvokeEvent):void {
//you don't actually have to loop as it will always be the first argument
for each(var a:String in e.arguments) {
//p - Show the screensaver in the screensaver selection dialog box
if (a.indexOf("/p")) {
//do something different for preview mode
break;
}
//s - Show the screensaver full-screen
if (a.indexOf("/s")) {
//the main full screen mode
break;
}
//c - Show the screensaver configuration dialog box
if (a.indexOf("/c")) {
//show a configuration window
break;
}
}
}