How to launch client machine exe file and not dependent on browser? - java

I want to launch a exe file when click on the button from my appliction and that should be from client machine. I tried with following solutions.
Runtime.getRuntime().exec(".....\\somefile.exe");
when I follows the above solution then it was opened server machine exe file.
I applied one more solution in script code
i.e
**var ws = new ActiveXObject("WScript.Shell");
ws.Exec("...\\somefile.exe");**
the above code working fine but I need to enable ActiveX related script enble mode in client browser window manually and it is only applied for IE only.
Let me know any solution that is browser independent and without activex enable option.

Related

Upload and Download File over Remote Node without Input Tag as File type

I am Automating a Scenario for Web Application Over Windows which includes the File And Images to be Uploaded to a website, and on my local it is working fine through robot class **
but when i execute my tests over Jenkins my jobs get failed. I need to Upload my file to a web site executing over Remote machine.
**
For File Upload :-
I cannot simply upload the file using send keys method since The Input tag doesn't have File Type i.e. input[type!='file'].
Are there any other solutions to achieve this without using Robot Classes and Auto-It.
**
For File Download:-
**
And I also need to download the File from a web Application over remote and verify that it has been downloaded successfully provided there is no API for this.
When the file gets downloaded over the remote, I am not able to verify that whether it has been downloaded or not since Remote Machine execution is not visible.
Is there any way to achieve this, kindly please suggest.
As you are using remote desktop for execution of scripts which would fail robot class action calls as it needs screen to be unlocked.
For the better results try using AutoIt is a free ware tools used for such purposes.
AutoIt will identify browse file objects and perform actions on it as Selenium does on Web applications.
Identify the Windows control, through AutoItV3 Windows Info tool.
More detailed steps to use AutoIt is present in the below link:
https://www.softwaretestinghelp.com/autoit-tutorial-to-download-write-autoit-script/
Thanks and regards,
Sandeep Jaju

Launch an Application from a Browser

I would like to have a link or button on my web site that launches
vim (an editor) on a specific file (e.g., myfile.txt) on my local machine.
I want to launch C:\Vim\Vim74\gvim.exe on C:\Users\paulco\myfile.txt form any browser.
I want this to work on all (realistically most) browsers.
I actively use Chrome, Opera, FireFox and IE (in that order of preference).
In order for it to work across all of these browsers,
I think the script has to Java-based.
Does anyone know how to do this?
Does anyone have a Java-based script that does this?
Here are some resources I found on the topic.
But either they are IE specific or don't work.
Launch application from a browser
http://msdn.microsoft.com/en-us/library/aa767914%28VS.85%29.aspx
I have tested the following on Internet Explorer, Chrome, Opera and Firefox.
The browser has to run on a Windows operating system, Linux and Mac require different aproaches.
Solution is to define a protocol handler for a custom protocol.
1) Take this HTML example, it should open the specified text file using notepad.exe:
Open Textfile
2) You need to define the protocol handler in the windows registry, save the following to a file named testing.reg and execute it (double click on it), or enter the values manually using regedit:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\test]
#="URL:Editor test"
"URL Protocol"=hex(2):00,00
[HKEY_CLASSES_ROOT\test\DefaultIcon]
#="\"C:\\Windows\\system32\\notepad.exe\""
[HKEY_CLASSES_ROOT\test\shell]
[HKEY_CLASSES_ROOT\test\shell\open]
[HKEY_CLASSES_ROOT\test\shell\open\command]
#="\"C:\\temp\\editor.bat\" %1"
3) As you can see, I am not calling notepad.exe directly, but a c:\temp\editor.bat batch file. This is because the file-parameter has to be modified. using the %1 as a parameter will pass the complete URL including the test: custom protocol name to the shell. In the script, I use a simple substring pattern to extract the specified file name and call the editor:
REM editor.bat
set param=%1
notepad %param:~5%
That's all!

How to interact with Windows GUI through Selenium

My selenium based test-suite works fine while I was controlling just the browser.
A new test case I need to add into the suite which requires interacting with Windows Browse/Upload file explorer after selenium has clicked upload button in under test page on the browser.
I couldn't find anything in Selenium RC documents about how to write filename in the (windows GUI) browse's "file name" field and click (windows GUI)Open button. Any ideas? Thanks!
Just to let you know in advance.
The test-suite executes test on 100s of remote machines concurrently. So auto-it-script workaround won't work for me.
Selenium RC supports file upload, but not using the browser mechanism directly. Check out the AttachFile() method, which takes a URL for the file and downloads it to the browser machine before then uploading it to the application.

Force Download on client machine

One of my requirements is, on load of page, a file is to be created dynamically and downloaded at a particular location on the client's machine.
In case the file is already present, it has to be over written.
is there any way where we can access the client's system and store the file at the required folder?
I feel one cannot access the client machine when the code is being executed on the server..
Senorio:
1-User click on generate document then it took template stream data ,req. data file and then save two file into client machine.
2-After that template open and it fetch the data file from same directory.
Please help me on this. This is an SOS!!
There are probably other solutions, I use a signed applet for this purpose.
As always, there are a few caveats though:
You can't "force" anything against the will of the user. Applets may be disabled in the client's browser, or they may not even have Java installed. Or the target directory might not be writeable by the user.Your server should handle cases where the client doesn't have the correct version of the file gracefully.
You can't do this from the server side obviously but you also really can't do this from a client script either. Browser security will prevent a page script from modifying contents of the file system.
Your only options will be to run a third-party browser plugin software that has elevated permissions.
Examples of such are
Java Applets
Java WebStart
Microsoft Silverlight
ActiveX
Each one is different and most require some level of user interaction to confirm that they allow plugins to run with elevated security.

WebBrowser1 problem with external web app

the external Application works good in IE so i know the problem is inside My App.
The external web app is java applet and java script based, and the problem im experiensing is when the java applet tryes to run a java script. The Applet opens a seconday window with a java script and tryes to do some operations but then i just stops. And my Application seems to be non responsive and i have to restart it.
in IE it works just fine, the java applet opens the window does its thing and updates back in to the Applet.
anyone know why it not working in the webBrowser control?
Two scenerio could be possible:
1) whenever we opens the web site in web browser control any previous session(authentication) cookie is not being reused, and new session will be created.
2) you have to override the eventhandler webBrowser_newWindow to allow opening the new window.

Categories