wpt_batch.py with chrome mobile emulation

Currently we run all of our tests via wpt_batch.py and have the xml result files stored externally for trend reporting. I would like to force some tests that I run from batch to run in Chrome mobile emulation mode on our local/private instance agents.

wpt_batch.py doesn’t have an option for enabling chrome mobile emulation so I am trying to figure out another method easier than creating a real mobile agent on site. Could I create a new agent entirely and set the Chrome application executable (in a WPT script that launches chrome) to run permanently with --window-size=360,640, for example?

Or is there an easier method to accomplish this? Our sites are 100% responsive so the most important thing for me right now is being able to change the browser or screen size to a smaller form factor to compare loading and kb to desktop/full browser mode. I am not as concerned right now with testing on different os/mobile platforms.

Mobile emulation is literally just passing one more option to the runtest.php call (mobile=1). You’re a LOT better off just adding it in to the wpt_batch.py

Otherwise you can use a script with the setviewport command to resize to whatever responsive size you want to test. You can use a static script that would work with all of the urls.

Something like:

setViewportSize	360	640
navigate	%URL%

That will automatically substitute the URLs being tested into the script and resize the browser before loading it.

Works perfectly. I will just keep a wpt_batch.py and a second wpt_batch_mobile.py with the following change. Thanks again Patrick.

def RunBatch(options):
“”“Run one-off batch processing of WebpageTest testing.”“”

test_params = {‘f’: ‘xml’,
‘private’: 1,
‘mobile’: 1,
‘priority’: 6,
‘video’: options.video,
‘fvonly’: options.fvonly,
‘runs’: options.runs,
‘location’: options.location,
‘mv’: options.mv
}