Webdriver automatically clears Text (Autosuggested text)entered in TextBox
up vote
0
down vote
favorite
WebDriver can identify the Text box.
WebDriver can pass the value through SendText to the Correct Textbox.
But the entered text get erased once i give the input to next field or perform any action.
Selenium Code:
if(!(e.getCellData("Security",11,i).isEmpty())) {
WebElement locator = wait.until(ExpectedConditions.elementToBeClickable(By.name("fisnIssuerShortName")));
locator.sendKeys(e.getCellData("Security", 11, i));
List<WebElement> optionsToSelect = d.findElements(By.xpath("//div[@class='ui-menu-item-wrapper']"));
for (WebElement option : optionsToSelect) {
System.out.println(option);
if (option.getText().equals(e.getCellData("Security", 11, i))) {
option.click();
break;
}
}
}
HTML Code:
<tr>
<td class="label" align="left" width="30%">FISN -Issuer Short Name</td>
<td align="left" width="10%">
<b> : </b>
</td>
<td width="60%">
<input type="text" name="fisnIssuerShortName" maxlength="15" size="70" value="" onblur="setFISNComponent('fisnIssuerShortName');" id="fisnIssuerShortName" class="textField ui-autocomplete-input" autocomplete="off">
(Abbrev)
</input>
</td>
</td>
</tr>
selenium selenium-webdriver automation ui-automation browser-automation
add a comment |
up vote
0
down vote
favorite
WebDriver can identify the Text box.
WebDriver can pass the value through SendText to the Correct Textbox.
But the entered text get erased once i give the input to next field or perform any action.
Selenium Code:
if(!(e.getCellData("Security",11,i).isEmpty())) {
WebElement locator = wait.until(ExpectedConditions.elementToBeClickable(By.name("fisnIssuerShortName")));
locator.sendKeys(e.getCellData("Security", 11, i));
List<WebElement> optionsToSelect = d.findElements(By.xpath("//div[@class='ui-menu-item-wrapper']"));
for (WebElement option : optionsToSelect) {
System.out.println(option);
if (option.getText().equals(e.getCellData("Security", 11, i))) {
option.click();
break;
}
}
}
HTML Code:
<tr>
<td class="label" align="left" width="30%">FISN -Issuer Short Name</td>
<td align="left" width="10%">
<b> : </b>
</td>
<td width="60%">
<input type="text" name="fisnIssuerShortName" maxlength="15" size="70" value="" onblur="setFISNComponent('fisnIssuerShortName');" id="fisnIssuerShortName" class="textField ui-autocomplete-input" autocomplete="off">
(Abbrev)
</input>
</td>
</td>
</tr>
selenium selenium-webdriver automation ui-automation browser-automation
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
WebDriver can identify the Text box.
WebDriver can pass the value through SendText to the Correct Textbox.
But the entered text get erased once i give the input to next field or perform any action.
Selenium Code:
if(!(e.getCellData("Security",11,i).isEmpty())) {
WebElement locator = wait.until(ExpectedConditions.elementToBeClickable(By.name("fisnIssuerShortName")));
locator.sendKeys(e.getCellData("Security", 11, i));
List<WebElement> optionsToSelect = d.findElements(By.xpath("//div[@class='ui-menu-item-wrapper']"));
for (WebElement option : optionsToSelect) {
System.out.println(option);
if (option.getText().equals(e.getCellData("Security", 11, i))) {
option.click();
break;
}
}
}
HTML Code:
<tr>
<td class="label" align="left" width="30%">FISN -Issuer Short Name</td>
<td align="left" width="10%">
<b> : </b>
</td>
<td width="60%">
<input type="text" name="fisnIssuerShortName" maxlength="15" size="70" value="" onblur="setFISNComponent('fisnIssuerShortName');" id="fisnIssuerShortName" class="textField ui-autocomplete-input" autocomplete="off">
(Abbrev)
</input>
</td>
</td>
</tr>
selenium selenium-webdriver automation ui-automation browser-automation
WebDriver can identify the Text box.
WebDriver can pass the value through SendText to the Correct Textbox.
But the entered text get erased once i give the input to next field or perform any action.
Selenium Code:
if(!(e.getCellData("Security",11,i).isEmpty())) {
WebElement locator = wait.until(ExpectedConditions.elementToBeClickable(By.name("fisnIssuerShortName")));
locator.sendKeys(e.getCellData("Security", 11, i));
List<WebElement> optionsToSelect = d.findElements(By.xpath("//div[@class='ui-menu-item-wrapper']"));
for (WebElement option : optionsToSelect) {
System.out.println(option);
if (option.getText().equals(e.getCellData("Security", 11, i))) {
option.click();
break;
}
}
}
HTML Code:
<tr>
<td class="label" align="left" width="30%">FISN -Issuer Short Name</td>
<td align="left" width="10%">
<b> : </b>
</td>
<td width="60%">
<input type="text" name="fisnIssuerShortName" maxlength="15" size="70" value="" onblur="setFISNComponent('fisnIssuerShortName');" id="fisnIssuerShortName" class="textField ui-autocomplete-input" autocomplete="off">
(Abbrev)
</input>
</td>
</td>
</tr>
selenium selenium-webdriver automation ui-automation browser-automation
selenium selenium-webdriver automation ui-automation browser-automation
edited Nov 22 at 20:30
SiKing
7,08072057
7,08072057
asked Nov 22 at 9:35
Prashant Shinde
14
14
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
The input you work with has an onblur
event set. The onblur
event occurs when an object loses focus. Probably you need to do any additional action to call it as it does not get fired when you use sendKeys. To do it try one of things
add click to any other element on the screen. For example click on the second input before entering any value to it. Or just click at any element that does not fire any event, any simple div or span would work
call an onblur event of an element via javascript after entering text to it
locator.sendKeys(e.getCellData("Security", 11, i));
((JavascriptExecutor)driver).executeScript("arguments[0].onblur();", locator);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
The input you work with has an onblur
event set. The onblur
event occurs when an object loses focus. Probably you need to do any additional action to call it as it does not get fired when you use sendKeys. To do it try one of things
add click to any other element on the screen. For example click on the second input before entering any value to it. Or just click at any element that does not fire any event, any simple div or span would work
call an onblur event of an element via javascript after entering text to it
locator.sendKeys(e.getCellData("Security", 11, i));
((JavascriptExecutor)driver).executeScript("arguments[0].onblur();", locator);
add a comment |
up vote
0
down vote
The input you work with has an onblur
event set. The onblur
event occurs when an object loses focus. Probably you need to do any additional action to call it as it does not get fired when you use sendKeys. To do it try one of things
add click to any other element on the screen. For example click on the second input before entering any value to it. Or just click at any element that does not fire any event, any simple div or span would work
call an onblur event of an element via javascript after entering text to it
locator.sendKeys(e.getCellData("Security", 11, i));
((JavascriptExecutor)driver).executeScript("arguments[0].onblur();", locator);
add a comment |
up vote
0
down vote
up vote
0
down vote
The input you work with has an onblur
event set. The onblur
event occurs when an object loses focus. Probably you need to do any additional action to call it as it does not get fired when you use sendKeys. To do it try one of things
add click to any other element on the screen. For example click on the second input before entering any value to it. Or just click at any element that does not fire any event, any simple div or span would work
call an onblur event of an element via javascript after entering text to it
locator.sendKeys(e.getCellData("Security", 11, i));
((JavascriptExecutor)driver).executeScript("arguments[0].onblur();", locator);
The input you work with has an onblur
event set. The onblur
event occurs when an object loses focus. Probably you need to do any additional action to call it as it does not get fired when you use sendKeys. To do it try one of things
add click to any other element on the screen. For example click on the second input before entering any value to it. Or just click at any element that does not fire any event, any simple div or span would work
call an onblur event of an element via javascript after entering text to it
locator.sendKeys(e.getCellData("Security", 11, i));
((JavascriptExecutor)driver).executeScript("arguments[0].onblur();", locator);
answered Nov 22 at 19:07
Vladimir Efimov
655311
655311
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427810%2fwebdriver-automatically-clears-text-autosuggested-textentered-in-textbox%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown