scripting164 Posted June 20, 2012 Posted June 20, 2012 Hii, I am using selenium rc with java and trying to upload file for test using autoit. I am able to do the same, but I have to write a new script for each file to be uploaded for different scenarios. Is there any way to pass file name as a parameter to the script, so that I can use only one script file. I tried this but it gives Error: Array variable has incorrect number of subscript Here is my script upload.au3: #include<IE.au3> If $CmdLine[0] < 2 Then WinWait("Choose File to Upload") $hChoose = WinGetHandle("Choose File to Upload") ControlSetText($hChoose, "", "[CLASS:Edit; INSTANCE:1]",$CmdLine[1]) sleep(2000) ControlClick($hChoose, "", "[CLASS:Button; INSTANCE:1]") EndIf And I am calling from java as below: _selenium.click("id=movie-path"); String[] cmd = {path_to_file }; Process proc1 = Runtime.getRuntime().exec( "uploadfile3.exe",cmd); Help needed...
scripting164 Posted June 21, 2012 Author Posted June 21, 2012 Now I am able to pass value.. There was small mistake in calling java program.. It should have been: Process proc1 = Runtime.getRuntime().exec( "uploadfile3.exe cmd");But now I am facing another issue. Since I have to pass value multiple times in the program, exe holds the previous value on first call and changes to the desired value on second call. Any idea how it can be solved??
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now