jeudi 14 décembre 2017

how to get the length of the given web element in protractor tests

I would like to find out the length of the variable which I get from the screen. If I use

var driverID = element(by.id('driverID')).getAttribute('value') 
driverID.length

it is throwing and error as Property 'length' does not exist on type'Promise <string>. Can some one help me in finding the length of the string.

I would also like to know how to use string operations in protractor tests. In this case I want to know, if the string first index is 'character or a number' and the second index is 'character or a number'. I want to do this by using the length of the string.

Aucun commentaire:

Enregistrer un commentaire