I would recommend you to use by.cssContainingText
element(by.cssContainingText('.col-sm-8', 'Account Information'))
There is no webdriver method which would allow locating an element by its text. You could try using xpath in the following way (not tested):
element(by.xpath('//div[contains(text(), "Account Information: ")]')
keep in mind by.cssContainingText
matches the element by PARTIAL text
so element(by.cssContainingText('div', 'male'))
will actually match both male
and female
text
To solve this, use xpath with exact text match
element(by.xpath('//div[text()="male"]'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With