Webdriver automatically clears Text (Autosuggested text)entered in TextBox
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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 |
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 |
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 '18 at 20:30
SiKing
7,27972461
7,27972461
asked Nov 22 '18 at 9:35
Prashant ShindePrashant Shinde
64
64
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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 |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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 '18 at 19:07
Vladimir EfimovVladimir Efimov
700513
700513
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.
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