operasoftware / operachromiumdriver

OperaDriver for Chromium-based Opera releases
Other
261 stars 47 forks source link

no implicit waitForPageToLoad with navigation history commands? #3

Open ychab opened 9 years ago

ychab commented 9 years ago

Hi,

When fetching a page (/session/:sessionId/url) or submitting a form, page load timeout is properly done. I mean, if I get source page immediatly after executing these commands, the output retrieved is correct.

But it seems to don't work well when playing with navigation history commands (prev/back). For example, if I navigate to page A then B, go back to A and immediatly get page source, it returns the page source of B, not A. If I wait that current url is A after executing the prev command and before getting source page, it is good.

I confess that we could do these kind of wait actions, but most of drivers didn't need it (including opera presto).

Thanks.

emakiej commented 9 years ago

Hi @chaby1 , thanks for your report! I'm not able to reproduce this issue. The only thing I reproduced is that the following python code

driver.get('https://www.google.pl')  
driver.get('http://www.wp.pl')  
driver.back()  
print driver.page_source

prints source code of an empty web page:

<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>

This is also reproducible witch ChromeDriver.

Can you provide a minimal testcase for what you've reported?

ychab commented 9 years ago

Hi @emakiej

Weird. With your example, I can get the source code of google (so not wp). However, current URL is an empty string. But if I manually sleep, I can get google url (sorry, not using Python binding but should be something like) :

driver.get('https://www.google.pl')  
driver.get('http://www.wp.pl')  
driver.back()  
# time.sleep(5)
print driver.current_url
print driver.page_source

Here is an another example with slow pages :

driver.get('http://www.amazon.com')
driver.get('http://www.nytimes.com')
driver.back();
# time.sleep(5)
if driver.current_url != 'http://www.amazon.com/' :
    print 'You need to wait manually after back command '

In this example, the main idea is to have pages which take time to be fully loaded. And once again, if we uncomment the manual sleep, page is fully loaded (document state is ready?) and we got the real current url.

Maybe could we easily reproduce it just with two simple html pages by adding a loop on client side to prevent document state to be ready quickly?

Anyway, are you able to reproduce it?

emakiej commented 9 years ago

Hi again, @chaby1 Yes, your testcase (the second one) is 100% reproducible on Opera with OperaDriver and 40% reproducible on Chrome with ChromeDriver. So it seems you can't rely also on ChromeDriver to wait until page is loaded before it handles next request. By "testcase is reproducible" I mean I get an empty url and the "You need to wait manually after back command" message. As we derive from ChromeDriver and this behaviour also is derived we don't concern this issue a bug.

ychab commented 9 years ago

Ok, so I guess we should instead open an issue for ChromeDriver and close this one? If true, for which version of Chromedriver should we open an issue? 2.13? How to know it?

emakiej commented 9 years ago

Yes. Current OperaDriver is derived from ChromeDriver 2.10. But the issue is still reproducible with ChromeDriver 2.13 (and seems to be 100% reproducible with this version). So I would suggest to report it for v. 2.13.