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;
}







0















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>









share|improve this question































    0















    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>









    share|improve this question



























      0












      0








      0








      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>









      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 20:30









      SiKing

      7,24472461




      7,24472461










      asked Nov 22 '18 at 9:35









      Prashant ShindePrashant Shinde

      14




      14
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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




          1. 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



          2. 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);








          share|improve this answer
























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            0














            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




            1. 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



            2. 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);








            share|improve this answer




























              0














              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




              1. 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



              2. 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);








              share|improve this answer


























                0












                0








                0







                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




                1. 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



                2. 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);








                share|improve this answer













                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




                1. 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



                2. 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);









                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 19:07









                Vladimir EfimovVladimir Efimov

                700513




                700513
































                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                    ComboBox Display Member on multiple fields

                    Is it possible to collect Nectar points via Trainline?