2

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?

1
  • Ok I decided to just hardcode a timeout ;X Commented May 27, 2016 at 14:23

2 Answers 2

4

There are the relevant built-in urlIs and urlContains expected conditions:

driver.wait(until.urlIs('url'));
driver.wait(until.urlContains('partOfUrl'));
Sign up to request clarification or add additional context in comments.

2 Comments

"TypeError: until.urlContains is not a function" ;<
@ClaireELi ah, sure, you need to upgrade to the latest selenium.
0

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");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.