Closed GoogleCodeExporter closed 9 years ago
Reading a bit more i found in the README the need to give a script instead a
url on the wpt side... (should be a good idea to update the documentation =) )
It is suddenly a bit more verbose :
/Users/xxx/Sites/webpagetest/agent/js/src/wd_sandbox.js:34
JSON.stringify(webdriver.promise.Application));
^
TypeError: Cannot read property 'Application' of undefined
at Object.<anonymous> (/Users/xxx/Sites/webpagetest/agent/js/src/wd_sandbox.js:34:37)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/Users/xxx/Sites/webpagetest/agent/js/src/wd_server.js:41:18)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
Btw , same results =/
Regards,
--
Regis A. Despres
Original comment by rdesp...@indolore.net
on 16 Sep 2012 at 7:20
I'd say the selenium compilation result with some error.
the file
/Users/xxx/Sites/Selenium/selenium-read-only/build/javascript/webdriver/webdrive
r.js is empty.
Keep searching...
Original comment by rdesp...@indolore.net
on 17 Sep 2012 at 12:21
Try to sync to head (r1519 or higher). I made it hermetic -- submitted the
WebDriver built artifacts and chromedriver into the WPT repo.
Also updated to the latest WD. One notable regression is the WDJS NodeJS flavor
no longer supports toSource(), so I disabled that branch in wd_sandbox.js, at
least until I figure out an alternative solution.
Original comment by k...@google.com
on 1 Oct 2012 at 3:31
r1520 -- also added a built dt2har jar to the repo so you won't need to run mvn
under lib/dt2har. The JS agent should now run out of the box, just make sure
you pass the right WPT server URL as wptdriver.sh --location.
Original comment by k...@google.com
on 1 Oct 2012 at 3:43
Nice !
Just tested and all the wrap around work.
Sadly, it "ends" like below.
Sounds like the JS i gave in input is wrong or mis-interpreted.
extra: "Got response: {\"Test
ID\":\"121001_Q9_5\",\"url\":\"script:\\/\\/121001_Q9_5.pts\",\"runs\":1,\"bwIn\
":1500,\"bwOut\":384,\"latency\":50,\"plr\":0,\"pngScreenShot\":1,\"imageQuality
\":75,\"script\":\"\\/*\\r\\nnavigate\\tgoogle.com\\r\\n*\\/\\r\\ndriver\\t =
new
webdriver.Builder().build();\\r\\ndriver.get(\\\\'http:\\/\\/www.google.com\\\\'
);\\r\\ndriver.wait(function()\\t {\\r\\nreturn\\t
driver.getTitle();\\r\\n});\"}"
alert: "Running job: 121001_Q9_5"
info: "Starting traffic shaping"
info: "Running script: /*\r\nnavigate\tgoogle.com\r\n*/\r\ndriver\t = new
webdriver.Builder().build();\r\ndriver.get(\\'http://www.google.com\\');\r\ndriv
er.wait(function()\t {\r\nreturn\t driver.getTitle();\r\n});"
info: "During import promise.Application: undefined"
info: "Starting WD server: java
-Dwebdriver.chrome.driver=/Users/xxxx/Sites/webpagetest/lib/webdriver/chromedriv
er/Darwin x86_64/chromedriver-23.0.1240.0 -jar
/Users/xxxx/Sites/webpagetest/lib/webdriver/java/selenium-standalone-r17891.jar"
info: "WD connect promise setup complete"
info: "WD STDOUT: 18:40:59.219 INFO - Java: Apple Inc. 20.6-b01-415\n"
info: "WD STDOUT: 18:40:59.221 INFO - OS: Mac OS X 10.7.4 x86_64\n"
info: "WD STDOUT: 18:40:59.229 INFO - v2.25.0, with Core v2.25.0. Built from
revision 17891\n"
info: "WD STDOUT: 18:40:59.350 INFO - RemoteWebDriver instances should connect
to: http://127.0.0.1:4444/wd/hub\n"
info: "WD STDOUT: 18:40:59.351 INFO - Version Jetty/5.1.x\n"
info: "WD STDOUT: 18:40:59.352 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]\n"
info: "WD STDOUT: 18:40:59.352 INFO - Started
HttpContext[/selenium-server,/selenium-server]\n"
info: "WD STDOUT: 18:40:59.352 INFO - Started HttpContext[/,/]\n"
info: "WD STDOUT: 18:40:59.621 INFO - Started
org.openqa.jetty.jetty.servlet.ServletHandler@37eb2c1b\n"
info: "WD STDOUT: 18:40:59.621 INFO - Started HttpContext[/wd,/wd]\n"
info: "WD STDOUT: 18:40:59.626 INFO - Started SocketListener on 0.0.0.0:4444\n"
info: "WD STDOUT: 18:40:59.626 INFO - Started
org.openqa.jetty.jetty.Server@690da5eb\n"
info: "WD STDOUT: 18:40:59.898 INFO - Executing:
org.openqa.selenium.remote.server.handler.Status@79ee2c2c at URL: /status)\n"
info: "WD STDOUT: 18:40:59.906 INFO - Done: /status\n"
info: "Sandbox finished, waiting for browser to coalesce"
info: "Copying seed property into sandbox: webdriver"
error: "Sandboxed session failed, calling server stop(): SyntaxError:
Unexpected token ILLEGAL\n at Object.WebDriverServer.runScript_
(/Users/xxxx/Sites/webpagetest/agent/js/src/wd_server.js:291:8)\n at
WebDriverServer.connect
(/Users/xxxx/Sites/webpagetest/agent/js/src/wd_server.js:262:18)\n at
webdriver.promise.Application.runInNewFrame_
(/Users/xxxx/Sites/webpagetest/lib/webdriver/javascript/node-r17891/webdriver/li
b/webdriver/promise.js:1275:20)\n at
webdriver.promise.Application.runEventLoop_
(/Users/xxxx/Sites/webpagetest/lib/webdriver/javascript/node-r17891/webdriver/li
b/webdriver/promise.js:1149:21)\n at
Timer.exports.setInterval.timer.ontimeout (timers.js:234:14)"
warn: "stop(): driver is already unset"
alert: "Finished job: 121001_Q9_5"
notice: "Job finished: 121001_Q9_5"
info: "WD STDOUT: 18:40:59.936 INFO - Shutting down...\n"
warn: "The main application has gone idle, history: "
warn: "The sandbox application has gone idle, history: "
extra: "postResultFile:
job={\"client_\":{\"baseUrl_\":{\"protocol\":\"http:\",\"slashes\":true,\"host\"
:\"xxxx\",\"hostname\":\"xxxx\",\"href\":\"http://xxxx/\",\"pathname\":\"/\",\"p
ath\":\"/\"},\"location_\":\"test\",\"job_timeout\":60000,\"_events\":{}},\"task
\":{\"Test
ID\":\"121001_Q9_5\",\"url\":\"script://121001_Q9_5.pts\",\"runs\":1,\"bwIn\":15
00,\"bwOut\":384,\"latency\":50,\"plr\":0,\"pngScreenShot\":1,\"imageQuality\":7
5,\"script\":\"/*\\r\\nnavigate\\tgoogle.com\\r\\n*/\\r\\ndriver\\t = new
webdriver.Builder().build();\\r\\ndriver.get(\\\\'http://www.google.com\\\\');\\
r\\ndriver.wait(function()\\t {\\r\\nreturn\\t
driver.getTitle();\\r\\n});\"},\"id\":\"121001_Q9_5\",\"resultFiles\":[],\"error
\":{}} resultFile=undefined isDone=true callback=function () {\r\n
self.emit('done', job);\r\n }"
Original comment by rdesp...@indolore.net
on 1 Oct 2012 at 7:20
You seem to have the magic quote PHP problem -- it backslash-escapes the single
quotes in the WD script. See
http://code.google.com/p/webpagetest/issues/detail?id=57 for the php.ini option
to get rid of that. I believe you need to restart Apache for it to take effect.
Original comment by k...@google.com
on 1 Oct 2012 at 7:42
Thanks for your quick reply =)
Unfortunately mqgpc are off and a new phpinfo() page says that all settings are
correctly interpreted ( fspawn-cgi + nginx ).
In case of something is missing, here is a full output :
$ bash wptdriver.sh -l test -s "http://xxx" -v -d -m 8
NODE_PATH=/Users/xxx/Sites/webpagetest/agent/js:/Users/xxx/Sites/webpagetest/age
nt/js/src:/Users/xxx/Sites/webpagetest/lib/webdriver/javascript/node-r17891
node src/agent_main --wpt_server http://xxx --location test --chromedriver
/Users/xxx/Sites/webpagetest/lib/webdriver/chromedriver/Darwin
x86_64/chromedriver-23.0.1240.0 --selenium_jar
/Users/xxx/Sites/webpagetest/lib/webdriver/java/selenium-standalone-r17891.jar
--devtools2har_jar=/Users/xxx/Sites/webpagetest/lib/dt2har/target/dt2har-1.0-SNA
PSHOT-jar-with-dependencies.jar
extra: "Created Client (urlPath=/):
{\"baseUrl_\":{\"protocol\":\"http:\",\"slashes\":true,\"host\":\"xxx\",\"hostna
me\":\"xxx\",\"href\":\"http://xxx/\",\"pathname\":\"/\",\"path\":\"/\"},\"locat
ion_\":\"test\",\"job_timeout\":60000}"
info: "Get work: http://xxx/work/getwork.php?location=test&f=json"
extra: "Got response: "
info: "Get work: http://xxx/work/getwork.php?location=test&f=json"
extra: "Got response: "
info: "Get work: http://xxx/work/getwork.php?location=test&f=json"
extra: "Got response: {\"Test
ID\":\"121001_P2_C\",\"url\":\"script:\\/\\/121001_P2_C.pts\",\"runs\":1,\"bwIn\
":1500,\"bwOut\":384,\"latency\":50,\"plr\":0,\"pngScreenShot\":1,\"imageQuality
\":75,\"script\":\"\\/*\\r\\nnavigate\\tgoogle.com\\r\\n*\\/\\r\\ndriver\\t =
new
webdriver.Builder().build();\\r\\ndriver.get(\\\\'http:\\/\\/www.google.com\\\\'
);\\r\\ndriver.wait(function()\\t {\\r\\nreturn\\t
driver.getTitle();\\r\\n});\"}"
alert: "Running job: 121001_P2_C"
info: "Starting traffic shaping"
info: "Running script: /*\r\nnavigate\tgoogle.com\r\n*/\r\ndriver\t = new
webdriver.Builder().build();\r\ndriver.get(\\'http://www.google.com\\');\r\ndriv
er.wait(function()\t {\r\nreturn\t driver.getTitle();\r\n});"
info: "During import promise.Application: undefined"
info: "Starting WD server: java
-Dwebdriver.chrome.driver=/Users/xxx/Sites/webpagetest/lib/webdriver/chromedrive
r/Darwin x86_64/chromedriver-23.0.1240.0 -jar
/Users/xxx/Sites/webpagetest/lib/webdriver/java/selenium-standalone-r17891.jar"
info: "WD connect promise setup complete"
info: "WD STDOUT: 22:22:08.240 INFO - Java: Apple Inc. 20.6-b01-415\n"
info: "WD STDOUT: 22:22:08.241 INFO - OS: Mac OS X 10.7.4 x86_64\n"
info: "WD STDOUT: 22:22:08.249 INFO - v2.25.0, with Core v2.25.0. Built from
revision 17891\n"
info: "WD STDOUT: 22:22:08.341 INFO - RemoteWebDriver instances should connect
to: http://127.0.0.1:4444/wd/hub\n"
info: "WD STDOUT: 22:22:08.342 INFO - Version Jetty/5.1.x\n"
info: "WD STDOUT: 22:22:08.342 INFO - Started
HttpContext[/selenium-server/driver,/selenium-server/driver]\n"
info: "WD STDOUT: 22:22:08.343 INFO - Started
HttpContext[/selenium-server,/selenium-server]\n"
info: "WD STDOUT: 22:22:08.343 INFO - Started HttpContext[/,/]\n"
info: "WD STDOUT: 22:22:08.496 INFO - Started
org.openqa.jetty.jetty.servlet.ServletHandler@24f9fdc\n"
info: "WD STDOUT: 22:22:08.496 INFO - Started HttpContext[/wd,/wd]\n"
info: "WD STDOUT: 22:22:08.501 INFO - Started SocketListener on 0.0.0.0:4444\n"
info: "WD STDOUT: 22:22:08.501 INFO - Started
org.openqa.jetty.jetty.Server@7f081d2e\n"
info: "WD STDOUT: 22:22:09.221 INFO - Executing:
org.openqa.selenium.remote.server.handler.Status@11e7c5cb at URL: /status)\n"
info: "WD STDOUT: 22:22:09.227 INFO - Done: /status\n"
info: "Sandbox finished, waiting for browser to coalesce"
info: "Copying seed property into sandbox: webdriver"
error: "Sandboxed session failed, calling server stop(): SyntaxError:
Unexpected token ILLEGAL\n at Object.WebDriverServer.runScript_
(/Users/xxx/Sites/webpagetest/agent/js/src/wd_server.js:291:8)\n at
WebDriverServer.connect
(/Users/xxx/Sites/webpagetest/agent/js/src/wd_server.js:262:18)\n at
webdriver.promise.Application.runInNewFrame_
(/Users/xxx/Sites/webpagetest/lib/webdriver/javascript/node-r17891/webdriver/lib
/webdriver/promise.js:1275:20)\n at
webdriver.promise.Application.runEventLoop_
(/Users/xxx/Sites/webpagetest/lib/webdriver/javascript/node-r17891/webdriver/lib
/webdriver/promise.js:1149:21)\n at
Timer.exports.setInterval.timer.ontimeout (timers.js:234:14)"
warn: "stop(): driver is already unset"
warn: "The main application has gone idle, history: "
warn: "The sandbox application has gone idle, history: "
alert: "Finished job: 121001_P2_C"
notice: "Job finished: 121001_P2_C"
extra: "postResultFile:
job={\"client_\":{\"baseUrl_\":{\"protocol\":\"http:\",\"slashes\":true,\"host\"
:\"xxx\",\"hostname\":\"xxx\",\"href\":\"http://xxx/\",\"pathname\":\"/\",\"path
\":\"/\"},\"location_\":\"test\",\"job_timeout\":60000,\"_events\":{}},\"task\":
{\"Test
ID\":\"121001_P2_C\",\"url\":\"script://121001_P2_C.pts\",\"runs\":1,\"bwIn\":15
00,\"bwOut\":384,\"latency\":50,\"plr\":0,\"pngScreenShot\":1,\"imageQuality\":7
5,\"script\":\"/*\\r\\nnavigate\\tgoogle.com\\r\\n*/\\r\\ndriver\\t = new
webdriver.Builder().build();\\r\\ndriver.get(\\\\'http://www.google.com\\\\');\\
r\\ndriver.wait(function()\\t {\\r\\nreturn\\t
driver.getTitle();\\r\\n});\"},\"id\":\"121001_P2_C\",\"resultFiles\":[],\"error
\":{}} resultFile=undefined isDone=true callback=function () {\r\n
self.emit('done', job);\r\n }"
extra: "Got response: "
info: "Get work: http://xxx/work/getwork.php?location=test&f=json"
extra: "Got response: "
info: "WD STDOUT: 22:22:10.536 INFO - Shutting down...\n"
info: "WD EXIT code 143 signal null"
info: "Cleaning up child processes"
Regards,
Original comment by rdesp...@indolore.net
on 1 Oct 2012 at 8:28
Maybe it's not because of gpc quotes, but either way it sounds like your PHP is
inserting a backslash that ends up breaking the JS. Your output:
extra: "Got response: {\"Test
ID\":\"121001_P2_C\",\"url\":\"script:\\/\\/121001_P2_C.pts\",\"runs\":1,\"bwIn\
":1500,\"bwOut\":384,\"latency\":50,\"plr\":0,\"pngScreenShot\":1,\"imageQuality
\":75,\"script\":\"\\/*\\r\\nnavigate\\tgoogle.com\\r\\n*\\/\\r\\ndriver\\t =
new
webdriver.Builder().build();\\r\\ndriver.get(\\\\'http:\\/\\/www.google.com\\\\'
);\\r\\ndriver.wait(function()\\t {\\r\\nreturn\\t
driver.getTitle();\\r\\n});\"}"
Output on my OSX setup with MAMP:
extra: "Got response: {\"Test
ID\":\"121001_3V_6\",\"url\":\"script:\\/\\/121001_3V_6.pts\",\"runs\":1,\"bwIn\
":1500,\"bwOut\":384,\"latency\":50,\"plr\":0,\"browser\":\"Chrome\",\"imageQual
ity\":75,\"script\":\"\\/*\\r\\nnavigate\\tgoogle.com\\r\\n*\\/\\r\\ndriver\\t=
new
webdriver.Builder().build();\\r\\ndriver.get('http:\\/\\/www.google.com');\\r\\n
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');\\r\\ndriver.fi
ndElement(webdriver.By.name('btnG')).click();\\r\\ndriver.wait(function()\\t{\\r
\\nreturn\\tdriver.getTitle();\\r\\n});\"}"
Notice how you get FOUR backslashes between driver.get( and 'http://, and I
have none. Since it's a double quoted string printout, the actual string has
two backslashes there in your case (and still none in my case). This log entry
is a raw printout of the server's HTTP response to the getwork.php request, so
it does look like your server is somehow inserting these backslashes. The WPT
PHP code does not do any special escaping either, so it's got to me something
in the PHP settings in your setup...
Original comment by k...@google.com
on 1 Oct 2012 at 8:57
If you grab the latest runtest.php from SVN it will transparently deal with
server installs that have magic quotes enabled.
Original comment by pmee...@google.com
on 9 Oct 2012 at 6:39
Yay !
Tested and worked like a charm.
Btw, is this a standard behavior that :
- there is only the first view
- there is no screenshots
Regards,
Original comment by regis.de...@gmail.com
on 18 Oct 2012 at 4:22
Right I didn't implement iterations:) Will work on that.
Screenshots are a bit difficult... I want to stay with pure WebDriver +
DevTools, and DevTools right now don't expose screenshots
(http://code.google.com/p/chromium/issues/detail?id=155101). WD OTOH does have
it, but the test script is using the WD. Everything is single threaded in JS --
it's like Windows 3 multitasking, only with explicit control passing:), so it's
kind of hard to ensure a truly periodic screenshot. And only one client can
talk to the same WD session, so I can't run a parallel process/thread with
another WD connection to the same session/tab.
It should be pretty straightforward to add a screenshot *after* the user script
finishes, as well as perhaps the end of certain specific WD API calls like
"get". I already intercept and sandbox the WD Builder API, I may as well
intercept the driver as well and inject my stuff.
Original comment by k...@google.com
on 18 Oct 2012 at 5:17
Hey,
From what i see in the logs, you're calling WD wire protocol .
From what i see below there is some ways to get b64 screenshot like :
http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/scre
enshot
If i understand correctly how it works (above), i'll try to help on the
sreenshot part.
Regards,
Original comment by regis.de...@gmail.com
on 18 Oct 2012 at 5:44
I am using the WebDriverJS binding, not the wire protocol directly. See also
http://code.google.com/p/selenium/issues/detail?id=4640.
Jason Leyba (a core WD developer) says the chromedriver serializes all calls,
i.e. a screenshot call would block while a get() is in progress, which kind of
defeats the purpose of this for pageloads, because very often most of the load
is while a get() runs. Since it's serialized like that, we may as well just do
it at the end of each WD call synchronously.
On Firefox a screenshot concurrent with get should actually work, per Jason,
except we may get an exception if there is no DOM yet, which we should just
ignore. But for Firefox I don't have performance instrumentation implemented in
the agent (yet), only for Chrome, so it's kind of moot.
Original comment by k...@google.com
on 18 Oct 2012 at 7:26
Hey,
Thanks for those useful informations.
A final screenshot operation should effectively a start.
Original comment by regis.de...@gmail.com
on 19 Oct 2012 at 11:00
Try it at the current head. Without video capture checked, it takes a
screenshot after get() and at the very end. With video capture checked, it also
takes progress screenshots after each WD call. The filmstrip view now also
shows these (wasn't showing PNG's before).
Original comment by k...@google.com
on 7 Nov 2012 at 3:44
Great !
I'll try this right away =)
Original comment by regis.de...@gmail.com
on 7 Nov 2012 at 5:29
Just FYI, the agent has been substantially overhauled, and the screenshots and
waterfalls should be more robust now. Please sync to head for both the agent
and the server.
Original comment by k...@google.com
on 14 Dec 2012 at 8:20
Good to know ! Tanks
Cdt,
Original comment by rdesp...@indolore.net
on 15 Dec 2012 at 10:12
Hey,
First, thanks again for all this !
I've taken some time to test today.
Here are some though :
- i had to update wpt (from 2.7 something) to trunk in order to work, i.e. :
screenshot not displayed , HAR empty ...
- i had some strange results regarding information like "fully load" and
"document complete", i.e. :
- tested on nissan.fr site for example
- 8.821s DC and 8.822s FL
- but i have in the HAR view something like 17s
- there is lot of similar strange output in debug regarding a lot of urls, i.e.
:
(
D 1218Z12:42:07.520 devtools2har.js:94 Socket.<anonymous>: devtools2har STDERR:
Dec 18, 2012 1:42:07 PM org.webpagetest.dt2har.converter.HarResource
createHarContent
WARNING: no content available for resource
)
Regards,
--
Regis A. Despres
Original comment by regis.de...@gmail.com
on 18 Dec 2012 at 3:03
Thanks for the feedback! I would appreciate if you could file a separate bug
and attach a zip of the result directory. Look under www/webpagetest/results --
take the test ID from the URL, that result's subdirectory is that same ID split
into parts.
Original comment by k...@google.com
on 18 Dec 2012 at 3:20
all done =) issue #127 created for this purpose.
--
Regis A. Despres
Original comment by regis.de...@gmail.com
on 18 Dec 2012 at 3:32
Original issue reported on code.google.com by
lulysscl...@gmail.com
on 16 Sep 2012 at 6:01