-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
follow link clicks #15
Comments
So, right now, link traversal is done with a click or whatever. (Pages can change in a number of ways) To wait until you're at the right new page though, I'd use a
That will correctly poll until it's true, and otherwise explode if it never becomes true. Does that help? |
I don't see assertLocation doing any polling in the code, how does that work? I think the ideal API would be
Where follow_link waits for any new page to load. Normally I never need to assert that a correct url loads, I just want to wait for the new page to load, which ends up asserting that a new page loads. |
I can sort of see the point of follow_link. It would, in this case, assume that the location should change, though, it wouldn't know to what. Then, you could wait for the DOM to be ready again. Though, having said that, assertLocation should work for you. I could add #assertLocationChanged(), which would be a, "assert it changed, but i don't care to what". Do you think that would be useful? |
yes, assertLocationChanged could be used to create follow_link. Ideally this would use onLoadFinished from phantomjs, but like I said, it isn't working for me. I would write assertLocationChanged myself if I understood how the polling worked. I tried out assertLocation and it didn't wait for the page to change from my previous click. Am I supposed to give it a wait time to make it work? |
Okay! I've added clickFollow as a possible body method (and there are now docs in the readme) .. does this cover your case? If so, I'll do a bump and release it. |
thanks for implementing, but this still doesn't work for me just as assertLocation doesn't work. I get a screenshot for the current page. When I wait for 2 seconds I get a screenshot for the page the link points to. |
I think I understand how this is supposed to work- the test is to be periodically retried every 75 ms for 1 second, whereas when I wait for 2 seconds it works. This is a pretty good demonstration of why timeouts are a bad hack to be avoided if possible. We should try to get onLoadFinished working. |
I opened a ticket for onLoadFinished not working with phantom.js here: http://code.google.com/p/phantomjs/issues/detail?id=265 |
Wait is a hack that slows things down and can give incorrect results.
I think it would be easy enough to follow links by using onLoadStarted and onLoadFinished. However, onLoadFinished does not get triggered for me. Any ideas?
The text was updated successfully, but these errors were encountered: