sebv/node-wd-sync

How to implement click and wait

Opened this issue · 0 comments

Hi,

Thanks for a great library! I've started to use the js version of the library and find it really useful. I'm trying to implement a click on an tag, load and verify the page title on the new page is correct.

I've tried to do something like this:

browser.waitForElementById("signin").click();
var var3 = "My Page Title";
var var4 = browser.title();
assert.equal(var3, var4, 'Assertion error on the page title: Expected: ' + var3 + ', got: ' + var4);

However, I don't always see the correct value at of the page title when I run this code, and sometimes see the old title, and sometimes the new one.

What is the best way to wait for the page to load before doing a check on something in the newly loaded page? I saw that there is a waitFor method in the API, but wasn't sure how to use it.

Thanks!