Forums - C# Corner

Forum guidelines
sireesha siri

sireesha siri

  • 1.5k
  • 2
  • 168

Protractor sendKeys issue with scripted info fields?

Feb 9 2018 8:19 AM
Hi,
 
I'm computerizing e2e tests with Protractor on a rakish application. Be that as it may, I have an issue when sending keys on input fields. The sent keys would miss few characters each time so I found a workaround :
 
static sendKeys(value, element){
value.split('').forEach((c) => element.sendKeys(c));
}
 
This functions admirably however it takes more than 3 times the time the first sendKeys capacity would.
Well, no issue my tests are still functional right? My application now has new fields with contents behind them. One of them is a date picker input, you can either browse the datePicker or sort it physically. Nonetheless, for the present date, you would type 09022018 and the slices are consequently added at the ideal place (like so 09/02/2018). If you somehow managed to enter a wrong date the field is cleared.
Presently back to the issue: it appears that both my usage of sendKeys and the first one free concentration after each submitted key. This implies I can't enter a substantial date in the information field as it's cleared after each mimicked keypress.
I could utilize browser.executeScript to settle it yet I wouldn't have the capacity to test the functionality including cuts. Additionally, as you compose, the date picker is as yet open and invigorates after each keypress, you can choose a date from it whenever and that is likewise an element I need to test.
 
Thanks and Regards
Sireesha