rshf / chromedriver

Automatically exported from code.google.com/p/chromedriver
2 stars 1 forks source link

ChromeDriver hangs when switching to new window whose document is being overwritten #450

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Open "http://localhost/myweb/test.html".
2.  Click button "OpenNewWindow" to open new page.
3. Enyo is used to load HTML page. Open a blank browser window, and then use 
Enyo Ajax to load page "ibtn.html" to the target page "main.html".
4. Switch to the new window to get page title "Window without frames" and the 
text "AAAAA".
5. Webdriver will hang when performing elements on new window, unless you quit 
the test manually in Eclipse.
6. Please help to confirm if it is a bug on chrome. Now the web app only works 
on chrome.

What is the expected output? 
Get page title "Window without frames" and the text "AAAAA".

What do you see instead?
WebDriver hang while executing the codes:

            System.out.println("+++" + driver.getTitle());
or
            WebElement e = driver.findElement(By.id("lv1"));
            System.out.println("+++" + e.getText());

In console I just find description like this:
+++CDwindow-FD4300A2-9F6D-407F-8008-97536C59D9F2
[3.051][INFO]: received WebDriver request: POST 
/session/df3a296b4a2cee10202bafb5fbdb5658/window {
   "name": "CDwindow-FD4300A2-9F6D-407F-8008-97536C59D9F2"
}
[3.055][INFO]: sending WebDriver response: 200 {
   "sessionId": "df3a296b4a2cee10202bafb5fbdb5658",
   "status": 0,
   "value": null
}
[3.058][INFO]: received WebDriver request: GET 
/session/df3a296b4a2cee10202bafb5fbdb5658/title 
[3.059][INFO]: waiting for pending navigations...

Selenium version: selenium-java-2.33.0.jar, 
selenium-server-standalone-2.32.0.jar
OS: Windows 7 64bit
Language: Java in Eclipse, Enyo used for loading HTML page
Browser: Chrome
Browser version: Chrome  27.0.1453.116 m
ChromeDriver: ChromeDriver server for win32 (v2.0.204324.dyu)

Original issue reported on code.google.com by songw...@gmail.com on 26 Jun 2013 at 6:16

Attachments:

GoogleCodeExporter commented 9 years ago
Same for me

Original comment by maxim.ap...@gmail.com on 9 Jul 2013 at 3:58

GoogleCodeExporter commented 9 years ago

Original comment by a.u.savchuk on 10 Jul 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Is it a known issue?

Original comment by songw...@gmail.com on 17 Jul 2013 at 2:58

GoogleCodeExporter commented 9 years ago
Reproduced using provided info (with small changes).

Last chromedriver hangs at getTitle after correct switching to newly opened 
window.

Original comment by a.u.savchuk on 31 Jul 2013 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago
Why would this be a medium priority. There is no work around apparently
Running chromedriver 2.6 against Chrome 31
The switchto window(windowhandle) will not allow any actions against the 
additional Window. Therefore any tests that interact with multiple window 
timeout

Original comment by kk859...@gmail.com on 13 Nov 2013 at 6:26

GoogleCodeExporter commented 9 years ago
Thanks for the report and the test case. REPRO CASE:

<html>
    <head>
        <script type="text/javascript">
            function open_win()
            {
                window.open("about:blank").document.write("<div>MOO</div>");
            }
        </script>
    </head>
    <body>
        <form>
            <input id="btnopen" type="button" value="open new window" onclick="open_win()">
        </form>
    </body>
</html>

def test():
...   d = webdriver.Remote('http://127.0.0.1:9515', {})
...   d.get('http://localhost:12345/page.html')
...   d.find_element_by_id('btnopen').click()
...   d.switch_to_window(d.window_handles[-1])
...   d.title

HANG!

Investigating what the root issue is...

Original comment by kkania@chromium.org on 13 Nov 2013 at 9:36

GoogleCodeExporter commented 9 years ago
seems like chromedriver's new connection load status detector is broken

it is trying to determine page load by appending a iframe that calls to 
about:blank during onload. but the document.write call overwrites that it seems

Original comment by kkania@chromium.org on 13 Nov 2013 at 9:48

GoogleCodeExporter commented 9 years ago
HACKY WORKAROUND:

var w = window.open("about:blank");
window.setTimeout(function() { w.document.write("<div>MOO</div>"); }, 1000);

Original comment by kkania@chromium.org on 13 Nov 2013 at 10:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Will chrome team provide some fix?

I have similar problem with chrome extension. 
I open testing url in the browser and then extension asynchronically execute:
chrome.tabs.create(...)
with another testing url as argument.
In test i wait for url to be changed:
wait.until(lambda driver: driver.current_url == ...)
but this line leads to error after 10 minutes of hanging:
Message: u'timeout: Timed out receiving message from renderer: 600.000\n  
(Session info: chrome=33.0.1750.146)\n  (Driver info: 
chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)'

I have already created new issue:
http://code.google.com/p/chromedriver/issues/detail?id=722
In the issue i wrote about NpApi extension. Now we uploaded new extension 
without NpApi to google market, so it isn't related to NpApi.

Original comment by WarmAndS...@gmail.com on 2 Apr 2014 at 2:02

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:19

GoogleCodeExporter commented 9 years ago
Issue 722 has been merged into this issue.

Original comment by agau...@chromium.org on 2 Apr 2015 at 2:04