catchpoint / WebPageTest.agent

Cross-platform WebPageTest agent
Other
213 stars 138 forks source link

Switch from Marionette to Webdriver for Firefox #348

Closed pmeenan closed 4 years ago

pmeenan commented 4 years ago

The python Marionette interface is deprecated and does not support Python 3. Webdriver is the supported automation interface and has mostly similar capabilities and API points.

pmeenan commented 4 years ago

Most of the transition is done and is being tracked on a webdriver branch. There are a few remaining issues before switching over:

1 - Keeping the profile between runs. For the "repeat view" WebPageTest test runs, it closes the browser then re-launches it to the same profile. It looks like webdriver completely nukes the profile when I quit the browser (I'm pointing to a custom directory). Is there any way to get it to not do that? I've seen some hacks where people clone the directory before quitting and then copy it back but that feels dangerous since it's being done while the browser is still open and didn't work on my early attempts.

2 - Do I need to do something special to access window.wrappedJSObject to access globals? The agent uses an extension that collects long tasks while the test is running and then extracts it by executing "window.wrappedJSObject.wptagentGetLongTasks();". It worked fine with marionette but fails with "JavascriptException: Message: TypeError: window.wrappedJSObject is undefined". I can probably find a different way to communicate with the extension but it would be nice if I was just holding it wrong.

3 - Is there any way to modify the UA string after the browser has started? WPT usually adds a PTST string to the end of the default browser UA string but I don't know the UA string until after the browser has started.

4 - Any way to modify prefs after the browser has started? This one is minor bot the WPT script lets you modify firefox prefs as it runs the script. Worst-case I can just make all of the modifications before launching the browser because I doubt anyone actually needs to change it mid-test but it was possible with marionette so I was just checking.

1 is the only hard-blocker, the rest can largely be worked around.

pmeenan commented 4 years ago

This is done and the default for Python 3 (and available on the command-line for python 2)