RE: Selenium 2.42.2 is not wotking to invoke .exe like for AutoIt

I want to upload a photo by selenium webdriver.
I used following environment:
[Selenium 2.42.2]
TestNg,
Firefox 26to 30,
[AutoIt][2]

Here is Test.java code


driver.findElement(By.id("photo")).click();
Runtime.getRuntime().exec("Z://browseExample.exe");


but selenium doesnot run the line to execute automatically.
If I manually clicks on “browseExample.exe” then it writes the desired path in browse textbox and clicks on open.

I noticed that, with selenium jar like 2.39, 2,38 it works fine.

But with those jars, my application’s one locator of password field is not working.
When password is entered it displays in plain text and even clicking on submit button, it doesn’t accepts that password

here is html of password field


<div class="formbox">

<input type="password" value="Password" onclick="this.value == 'Password' ? this.value = '' : this.value;" onfocus="this.select()" onblur="javascript:return ShowDefaultText();" maxlength="255" title="Please enter password" name="textBoxPassword" tabindex="2" id="textBoxPassword" style="display: none;">

<input value="Password" onclick="this.value == 'Password' ? this.value = '' : this.value;" onfocus="javascript:return HideDefaultText();" maxlength="255" title="Please enter password" tabindex="2" name="textBoxPasswordRegular" class="logintext" id="textBoxPasswordRegular" style="display: block;">

</div>

Here is AutoIT code of  browseExample.exe


; Wait 10 seconds for the Upload window to appear
WinWait("[CLASS:#32770]","",10)
; Set input focus to the edit control of Upload window using the handle returned by WinWait
ControlFocus("File Upload","","Edit1")
Sleep(2000)
; Set the File name text on the Edit field
ControlSetText("File Upload", "", "Edit1", "Z:\snipett.txt")
Sleep(2000)
; Click on the Open button
ControlClick("File Upload", "","Button1");

sk Train Asked on August 29, 2014 in Selenium WebDriver.
Add Comment
1 Answers
Best answer

I used code for login as


getPassWord().click();

getPassWord2().sendkeys("yourPassword");


where
public static final String password = "#textBoxPasswordRegular";

public static final String password2 = "#textBoxPassword";

so it worked for login functionality for selenium 2.39 and my code of file upload also worked for that.
However selenium 2.42.2 has problem with calling an exe.

Train Answered on September 1, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.