firebug / har-export-trigger

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

Selenium Python test #21

Closed amohideen closed 8 years ago

amohideen commented 8 years ago

I wrote a simple selenium test driver with har-export-trigger, however, I don't see anything happening. I may be wrong.. please let me know.

`#! /usr/bin/python import time import os from selenium import webdriver from selenium.webdriver.common.keys import Keys

count = 0 while count < 5: profile = webdriver.FirefoxProfile() profile.add_extension("harexporttrigger-0.5.0-beta.4.xpi")

set firefox preferences

profile.set_preference("app.update.enabled", 0) domain = "devtools.netmonitor.har."

set the preference for the trigger

profile.set_preference("extensions.netmonitor.har.contentAPIToken", "test") profile.set_preference("extensions.netmonitor.har.autoConnect", True) profile.set_preference(domain + "enableAutoExportToFile", True) profile.set_preference(domain + "defaultLogDir", "/home/mohideen/test") profile.set_preference(domain + "pageLoadedTimeout", 1500)

time.sleep(2)

create firefox driver

driver = webdriver.Firefox(profile) driver.get("https://www.python.org") count=count+1 time.sleep(2)

close the firefox driver after HAR is written

driver.close()

`

It opens up Firefox with no errors, i'm not sure if I'm entirely missing something.

I'm on Firefox 45

amohideen commented 8 years ago

It worked, its just that the version I was using was old.. I replaced profile.add_extension("harexporttrigger-0.5.0-beta.4.xpi") with profile.add_extension("harexporttrigger-0.5.0-beta.7.xpi") and downloaded the harexporttrigger-0.5.0-beta.7.xpi to my script directory.