FuckTheWorld / chromedriver

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

/session/:sessionId/log doesn't return all available log entries #1098

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am running a webdriver test against the HTML page quoted below and I am 
performing the following steps:

1) Load the page
2) access the logs with "/session/:sessionId/log". This only returns one 
InitialError entry.
3) I wait for 10 seconds.
4) I call "/session/:sessionId/log" again. Nothing is returned.

Expected behavior:
Step 4 should have returned a couple of RepeatedError entries.

Work arround:
If I execute the script "1+1" with "/session/:sessionId/execute" before 
accessing the logs in step 2) and 4) everything works as expected and 
"/session/:sessionId/log" returns a couple of RepeatedError entries in step 4.

Example Page:
<html>
  <head>
    <title>Hi</title>
  </head>
  <body>
    <p>Hello world!</p>
    <script type="text/javascript">
      window.onload = function() {
        console.error("InitialError");
        window.setInterval(function() {console.error("RepeatedError");}, 1000);
     }
    </script>
  </body>
</html>

Background:
https://github.com/angular/angular/blob/master/modules/benchpress/src/webdriver/
chrome_driver_extension.js#L43

Original issue reported on code.google.com by goderba...@google.com on 15 May 2015 at 6:14

GoogleCodeExporter commented 9 years ago
Issue is reproducible

Code:-

System.setProperty("webdriver.chrome.driver", "/pathto/chromedriver2.15");
System.setProperty("webdriver.chrome.logfile", "pathto/logs.log");

LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.BROWSER, Level.ALL);
logs.enable(LogType.DRIVER, Level.ALL);
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability(CapabilityType.LOGGING_PREFS, logs);

ChromeDriver driver = new ChromeDriver(caps);
driver.get("file:///pathToHtml/Issue1098.html");
for (LogEntry e : driver.manage().logs().get(LogType.BROWSER)) {
                 System.out.println(e.getMessage());
         }
Thread.sleep(10000);
         driver.executeScript("1+1");
         System.out.println("logs after 10secs");
         for (LogEntry e : driver.manage().logs().get(LogType.BROWSER)) {
             System.out.println(e.getMessage());
     }

If we do not call "driver.executeScript("1+1") , no log is fetched in the 
response
From the logs:-
[0.659][INFO]: COMMAND GetLog {
   "type": "browser"
}
[0.659][INFO]: RESPONSE GetLog [ {
   "level": "SEVERE",
   "message": "file:///pathToHtml/Issue1098.html 9:17 InitialError",
   "source": "console-api",
   "timestamp": 1431732155781.0
} ]
[5.663][INFO]: COMMAND GetLog {
   "type": "browser"
}
[5.663][INFO]: RESPONSE GetLog [  ]    ==>No log fetched

Marking the bug as unTriaged

Original comment by gmanikp...@chromium.org on 19 May 2015 at 6:55

GoogleCodeExporter commented 9 years ago

Original comment by gmanikp...@chromium.org on 26 May 2015 at 11:42