How to run jar file on button click in my html page? - java

 I have created testing automated script for a webpage of my desktop application. so it runs fine manually from eclipse. I am using selenium web driver and java.
Now I want to create GUI/Easy interface where I can get input from user And RUN my file on button click,so when tester gives input and tap on button ,we see out put fro my script on the samepage
I have exported all functions as Runnable JAR , So now I need to know how can I call and run these runnable jar from html page?on click. Is there any easy way for this?
Please help me

Related

Java executable jar, Window program file folder and administrator privilages

This is for Window 7 and Window 10
We have requirement to generate jar inside c:program file only. Installer can easily install our jar into c:\\ProgramFile\\testapp. After that we have the requirement to download the zip file from third party server inside c:\\ProgramFile\\testappp and here we are getting the access denied.
After lot of research, we come to know, we can run our jar under administrator privileges using super-user-application-0.0.5.jar.
Now the problem is We are getting the "User account control popup" with message "Do you want to allow the following program to make changes to this computer"
We don't want this popup so anyone know how to bypass this popup?
The important code from super-user-application-0.0.5.jar is
Shell32X.SHELLEXECUTEINFO execInfo = new Shell32X.SHELLEXECUTEINFO()
execInfo.lpParameters = args
execInfo.lpDirectory = lpDirectory
execInfo.fMask = Shell32X.SEE_MASK_NOCLOSEPROCESS
execInfo.lpVerb = "runas"
boolean result = Shell32X.INSTANCE.ShellExecuteEx(execInfo)
execInfo.lpVerb = "runas" is actually opening the popup. Is there any way, just bypass the popup and further processing should be similar to the saying OK to the popup.
Any chance to java programatically provide admin rights to the testapp folder created inside c:\ProgramFile\testapp

Run .jar file, but stop in first form

I Using:
NetBeans: IDE 7.4
Java : jdk1.7.0_51
javax.swing and RXTXcomm for my RFID
When i try to run .jar file, the program can running,
First form is login form, after i input username and password then click Login,
after that remain in the login form, which should be changed to the form menu.
Can anyone help me?

transformation from Java application to Java app (NetBeans)

I have finished a java application in NetBeans (made of single jFrame form), but was at the very end instructed, to transform it an app. I did so by adding a new jApplet form to the same project and copied all of the contents from jFrame form, onto a new jApplet form, and it runs perfectly from Netbeans. However, when i try to run the app.class from the HTML document in the browser, it doesn't run and displays the following error:
HTML file (positioned in the same folder as NewJApplet.class(..Gume\build\classes\demo)) contains:
<applet code="NewJApplet.class" height=800 width=600></applet>
Project structure:
I tried running the automatically generated html file, but it displays just a gray area.
Please help me solve the problem, i'm really short on time. Thank you.

Automating the action of downloading file and validating the status

My requirement, after cliking on the Export button, os save dialog appears where i need to select the download path and save it. Also i need to wait till the file download complete to make sure that the file is downloaded successfully.
I have used Selenium Webdriver till cliking on the Export button, I have handled the os save dialog for firefox browser by setting the firefox profile preferences to auto downlaod the file to the provided path. File starts downloading, but am stuck in verifying the status of file download. My file size varies and hence i cant wait for some time and check in the downlaod path, if the file exists. Also i will be not knowing the file name while exporting and #href attribute of Export button doesnot provide any url info.
can i use AutoIT? as am working on Windows platform.
I need to implement the above in IE, Chrome browsers as well. Pls let me know the possible solutions to handle the os save dialog and to verify the status of file download.
See if this helps: http://imobiliarerolabs.tumblr.com/post/64859016557/how-to-use-sikuli-when-automating-tests-with-selenium
It's Sikuli and can be used with Selenium.

File Upload Feature using Selenium and java

I need to automate the file upload feature in a web console and i am using selenium and java for this.
I tried multiple approaches but when i click on upload button and windows explorer gets opened, it stops there.
doesn't select any file...and gives error that there is no file..
I tried in firefox and chrome both but i am not able to solve this problem.
Then i also tried AutoIt tool. I downloaded it and made a script. trying to compile my script i am getting this error:
Code I'm using:
WebDriver driver = new FirefoxDriver();
driver.get("localhost:8080/page");
WebElement selectUploadApk = driver.findElement(By.id("id of upload button"));
selectUploadApk.click();
WebElement file = driver.findElement(By.xpath("//input[#type='file']"));
file .sendKeys("path of the file");
Error: Unable to execute upx.exe to compress stub file
File not found Exception
Please help
Thanx in advance
Megha
You don't need to click on the field to open the dialogue box.
Opening the dialogue box is what is 'breaking' your test.
Just send the keys directly to the input element, as you are, and then click on which ever button is the 'upload' button.
driver.findElement(By.xpath("//input[#type='file']")).sendKeys("/path/to/file");
driver.findElement(By.id("id of upload button")).click();

Categories