titleContains() in protractor ?
- titleContains() will verify the current web page title contains a substring.
- If title not contains substring in given time, it will throw time out error.
- title should be case-sensitive.
Please check below code script:
First check the page title in DOM
describe('Protractor - waits - titleContains()', function () {
beforeAll(async function () {
await browser.get("https://keeplearners.blogspot.com/2018/03/Angular-elements.html");
});
it('Code script to use waits - titleContains() in protractor', async function () {
var EC = protractor.ExpectedConditions;
await browser.wait(EC.titleContains("Keep Learning"), 5000, "expected title is not present in element");
await console.log("Title verified");
});
});
Output:
Here we are giving time out 5000ms to verify whether title contains given substring.
If title not matches given substring, it will display a time out error like below:
titleContains() will matches/check a given substring is case sensitive.
Please comment below to feedback or ask questions.
No comments:
Post a Comment
Please comment below to feedback or ask questions.