How can I verify the length of text of a cell after sending keys?

47 Views Asked by At

I have a field I am populating with text and trying to ensure that only the first 9 characters are pasted since there there is a restriction on how many characters should be able to be pasted to the field.

I am sending the keys as:

cusipField.sendKeys("1234567890") ;

The command to get text I believe would only work after saving. This is what I was hoping I could use :

cusipField.getText() ;

Is there way to get the text out of an editable field?

1

There are 1 best solutions below

1
Grooveek On

If your 'field' is an input, its text is hiding in the value attribute which you can get as :

element.getAttribute("value")