firebug / har-export-trigger

Trigger HAR export any time directly from within a page.
Other
53 stars 13 forks source link

har export trigger does not work at all ... #54

Open alex4200 opened 6 years ago

alex4200 commented 6 years ago

I tried the description given in the main page: http://www.softwareishard.com/blog/har-export-trigger/

and created the following script:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

profile = webdriver.FirefoxProfile()
profile.set_preference("devtools.netmonitor.har.contentAPIToken", True)
profile.set_preference("extensions.netmonitor.har.autoConnect", True)
profile.set_preference("devtools.netmonitor.har.enableAutoExportToFile", True)

driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

I downloaded the extension from this page and put it into the firefox extension folder (which I need to do later as the tests are running inside a docker image. So I need a way to copy and enable an extension without any firefox GUI), renamed as

harexporttrigger@getfirebug.com.xpi

However, after running the script, no har file or folder is being created.

soulgalore commented 6 years ago

Hi @alex4200 if you are using later versions of Firefox you need to use https://github.com/devtools-html/har-export-trigger to get the HAR. If I remember correctly firebug/har-export-trigger only works in FF 54 or earlier.

For copying/installing the plugin in Docker, you can mount the plugin from the outside of the container and add the extension something like this, (that is NodeJS of Selenium but it should be something like that in Python too).

Best Peter