Pages

How to wait for text present in element value in protractor ?

 textToBePresentInElementValue() in protractor ?

  • textToBePresentInElementValue() will checking if the given text is present in the element value.
Please check below code script:

First check the web element in DOM

How to wait for text present in element value in protractor
textToBePresentInElementValue() in protractor


Here we have one button it has value "This button is enabled".

describe('Protractor - waits - textToBePresentInElementValue()', function () {
beforeAll(
async function () {
await browser.get("https://keeplearners.blogspot.com/2018/03/Angular-elements.html");
});
it(
'Code script to use waits - textToBePresentInElementValue() in protractor', async function () {
var EC = protractor.ExpectedConditions;
var valueButton = element(by.css("input#enable"));
await browser.wait(EC.textToBePresentInElementValue(valueButton, 'This button is enabled'), 5000);
await console.log("Verified that text is present in element value");
});
});
Output:
How to wait for text present in element value in protractor
textToBePresentInElementValue() in protractor
Please comment below to feedback or ask questions.

No comments:

Post a Comment

Please comment below to feedback or ask questions.