Unable to enter Full values using Selenium Script, only half of the values are passed in to the field

Multi tool use
Multi tool use


Unable to enter Full values using Selenium Script, only half of the values are passed in to the field



I am trying to enter a text into an "unselectable row" sometimes it enters only half of the text (it fails to enter first few Characters)



E.g:
If I am trying to enter "qqwwssagsdafdsagdfgafgafdahdghjagds" text, sometimes it accepts only last few characters i.e. fgafdahdghjagds.



HTML code of the element which i am trying to enter Values:



HTML:


<div id="ext-comp-1002" class="x-layer x-editor x-small-editor x-grid-editor" style="position: absolute; z-index: 11000; visibility: hidden; left: -10000px; top: -10000px; overflow: auto; width: 238px;">
<input id="mltprcrtmain-1" class=" x-form-text x-form-field x-form-fieldui x-form-field-text " type="edit" name="mltprcrtmain-1" autocomplete="off" size="20" style="width: 238px;" maxlength="32">



Script which i have used to pass values in unselectable row (i.e.row) :



Code:


Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.id(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,2)))).click();
act.sendKeys(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,3));
Thread.sleep(5000);
act.sendKeys(Keys.ENTER);





Please show us your code
– Andrei Suvorkov
Jul 2 at 13:12





HTMl code of the element which i am trying to enter Values: <div id="ext-comp-1002" class="x-layer x-editor x-small-editor x-grid-editor" style="position: absolute; z-index: 11000; visibility: hidden; left: -10000px; top: -10000px; overflow: auto; width: 238px;"> <input id="mltprcrtmain-1" class=" x-form-text x-form-field x-form-fieldui x-form-field-text " type="edit" name="mltprcrtmain-1" autocomplete="off" size="20" style="width: 238px;" maxlength="32">
– Vignesh Krishnamoorthy
Jul 2 at 13:14





Script which i have used to pass values in unselectable row (i.e. row) : Actions act = new Actions(driver); act.moveToElement(driver.findElement(By.id(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,2)))).click(); act.sendKeys(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,3)); Thread.sleep(5000); act.sendKeys(Keys.ENTER);
– Vignesh Krishnamoorthy
Jul 2 at 13:16





Please add code in question, not in comment
– Andrei Suvorkov
Jul 2 at 13:16





As seeing your html code input tag have size attribute which limits your input in this field .
– Ankur Singh
Jul 2 at 13:37




2 Answers
2



As per your input HTML, your input text box size is 20 and it will support maximum of 32 characters.So, we should able to enter only max of 32 characters and only few characters will be visible in UI(At Max, 20 characters will be displayed and it may be changed based on the attribute which is mentioned in the class).



You are trying to enter a text with 35 characters and hence few characters might not be entered correctly



I would suggest to validate the entered character manually and also ensure the same by manually entering the same character.



Try to add a small pause in code after click:


Actions act = new Actions(driver);
act.moveToElement(driver.findElement(By.id(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,2)))).click();
Thread.sleep(2000); // add a small pause after click
act.sendKeys(genericHandlingExcel.getdata(FilePath, Sheetname2, 66,3));
Thread.sleep(5000);
act.sendKeys(Keys.ENTER);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

zOxByKs Ck l nsGntdpY0KNM2sqTXQJlaMWbIyma9cauU3k7RBRHJnuxnTXZS4LcZ,okcV,oTQz,0pIYSw
ETTbwkE5e00zE2wlDVmc b35,jBr2qoYiHqnMkqCk3ehzw xbSgaW887Fo,Z0CsZ,ET t6l jkAy3HjfZuBw1b3xuxaAXgiGu

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications