mardi 14 janvier 2020

Testcafe: How to grab the text not from html code (selector) but in field on UI

I need to extract parts of string from the text which was written in the field (input) on UI (This text is not in HTML code). I am trying sth like this (but it does not work).

const textInput = await model.inputtTittle.textContent;
console.log(textInput)

Nothing return probably textContent take text from the selector, I was trying with .innerText but it also returned nothing.

And then I would like to write sth like this:

 if (textInput.length > 32)
     await t.typeText(model.inputTittle, textInput.substr(0, 30));

I hope that it will be work if I have the content of the field inputTittle.

Aucun commentaire:

Enregistrer un commentaire