Reputation: 453
I need to wait until the webpage is loaded after clicking a link. The new page's title is not changed, only the url changed from "something.com" to "something.com/abc". So I can't use
driver.wait(until.titleIs('new title'));.
Is there any function I can use?
Upvotes: 2
Views: 3815
Reputation: 186
You can try binding the event to the element that appears.
const getElementById = async (id, timeout = 2000) => {
const el = await driver.wait(until.elementLocated(By.id(id)), timeout);
return await driver.wait(until.elementIsVisible(el), timeout);
};
someElement = await getElementById("someId");
Upvotes: 0
Reputation: 474161
There are the relevant built-in urlIs
and urlContains
expected conditions:
driver.wait(until.urlIs('url'));
driver.wait(until.urlContains('partOfUrl'));
Upvotes: 4