textToBePresentInElement() in protractor ?
- textToBePresentInElement() will checking if the given text is present in the element
Please check below code script:
First check the web element in DOM
Here we have one button it has text "Click Me"
describe('Protractor - waits - textToBePresentInElement()', function () {
beforeAll(async function () {
await browser.get("https://keeplearners.blogspot.com/2018/03/Angular-elements.html");
});
it('Code script to use waits - textToBePresentInElement() in protractor', async function () {
var EC = protractor.ExpectedConditions;
var clickMeButton = element(by.css("button[ng-click='clickMe(angularAlert)']"));
await browser.wait(EC.textToBePresentInElement(clickMeButton, 'Click Me'), 5000);
await console.log("Verified that text is present in element");
});
});
No comments:
Post a Comment
Please comment below to feedback or ask questions.