Open an exe window - java

I want to customize the browser by adding a new button in the main menu the requirement is when i click on the button it should open an exe its working good by opening it in a new window i want the window to be displayed in the browser itself. eg. in mozilla firefox i give a button to open openoffice.exe. Its opening as a new window and i am able to close the browser by keeping the exe file opened. I want to open the exe file of open office in the browser so that when i click the link in the window it opens the new open office writer in the browser itself. Any idea how can i implement that

An exe file (Executable) file is an independent file. It will always run in its own window no matter from where it is called. If you want to open a document in your browser window, simple link the file created in that exe file. For example if you want to show a MS-Word document in the web browser, then instead of providing the link to MS-Word, provide a link to the Word documument (.doc or docx). Remember this behaviour requires that the linked files must have a registered application installed on the computer.

Related

Open file dialog using in Java selenium test case

In my angular application, I am writing test cases using selenium.
In one of the test suite, I have a scenario where on click of a button, I need to open a Windows FileInput dialog and select a file that is passed and read the data in the file.
How can I achieve this.
I am using like this but nothing happens. How can I achieve this?
driver = Chrome webdriver;
element = driver.find_element_by_id("fileUpload")
element.send_keys("myfile.txt")
Uploading file with Selenium is done not the same way human user does.
With Selenium you should bot click on dialog, open OS browsing dialog, select file and click "upload" button.
With Selenium uploaded file should be sent to a special element presented on the page.
This is not a visible element.
It can be located by following XPath: "//input[#type='file']". The same with CSS Selector "input[type='file']".
Full absolute path to uploaded file should be sent to that element.
Like the following:
driver.findElement(By.xpath("//input[#type='file']")).sendKeys("C:/path/to/file.extension");

How to handle FileUpload using selenium-Webdriver

//div[#id='upload_button']
driver.findElement(By.xpath("//div[#id='upload_button']")).click();
driver.findElement(By.xpath("//div[#id='upload_button']")).sendKeys("V://Images//CSV/text.csv");
I have a upload button in my browser
written a script that will click the button and send the mentioned file from given path
Here it is selecting the Upload button and file explorer opening
Not opening path, to send the csv file
If //input[#type='file'] is present at least one time in the HTML-DOM, the you can directly send the keys, you do not need to
Click on upload button
Select file using explorer
and upload the file.
This feature was introduced in one of the Selenium 3 versions.
Effective code:
driver.findElement(By.xpath("//input[#type='file']")).sendKeys("V://Images//CSV/text.csv");
I would recommend that use explicit wait for more stability.
driver.findElemnt(By.xpath("//input[#type='file'])).sendKeys(" give source file path");

Users on Chrome OS cannot view .csv or .xls file opened in new tab

We have a simple link that serves up a downloadable version of a report in .pdf, .csv, and .xls formats. Recently, the .csv and .xls options have stopped working for our chromebook users while the .pdf version continues to work as intended. Where the link used to prompt the user for a download, or open in a new tab, it now does nothing. The only workaround other than using a different OS is the following:
Before you go to click "View" to download the link:
Right click on the page and select "Inspect" or press Ctrl Shift i to open the developer tools
On the new screen select the "Console" tab at the top
Click the "View" link to see the report like before
You should notice a warning message in the console at this point
Right click on the link in that warning message
Select open in new tab
The document should open in Google Sheets
The link in the warning message described in the list is a warning thrown by Chrome browser.
Resource interpreted as Document but transferred with MIME type text/csv:
We've released this workaround to our support users, but obviously can't ask clients to use the developer tools to download their file. Any assistance would be greatly appreciated. It should be noted that this problem is only for our Chrome OS users, and not any other users on the Chrome browser.
If you're having trouble inspecting on the current version (Chrome OS) hi-light this javascript code and drag it to your Chrome bookmarks bar:
javascript:alert("Inspect Element On");javascript:document.body.contentEditable = 'true'; document.designMode='on'; void 0;javascript:alert(document.documentElement.innerHTML);

Clicking on an URL to launch local application with parameters with Java

I've got a webapp which displays articles and pictures which will be printed in newspapers.
The webapp is just displaying a list of articles with their pictures thumbnails.
Clicking on the articles or thumbnails permits to launch InDesign and edit the article with its pictures (InDesign is a PAO app).
Actually, this works only with Firefox. If using Chrome or IE, InDesign application won't be launched. Instead the article will be downloaded and I'll have to double-click on the downloaded file in order to edit it from within InDesign.
Since Firefox v.48, this doesn't work anymore and clicking on the picture just download it.
What I want to build is a Java app that will listen a specific port, waiting for arguments (a local file location). Each time I'll click on a picture, InDesign will be launched directly.
So, in my webapp, each article/picture will have a href looking like :
http://localhost:6789/myJavaLauncher/localFileLocationToOpenWithInDesign
When clicking on such a link, any article will be open directly in InDesign for editing purpose.
How should I do that ?
-> what is the best way to catch all args passed in the URL (path and file name) and send them to a local Java app that will launch the correct application for the given file ?
Thanx by advance.

Upload file from desktop to Java applet application

How I can upload a file from desktop to Java applet application?
Create upload button.
Browse thought the desktop and choose the file.
Then create a link that enables the user to click on and open the chosen file.
use swing for example, just a button
use JFileChooser
It is not clear: do you want a link where ? (if it is on the web, you have to transmit it, or it can be on the applet: why not a button ?), and does it be called another time ?
General question: what is the purpose of this file ?

Categories