add method to retrieve har
parent
8d9ba4d663
commit
d7bfe4ed40
|
|
@ -3,6 +3,7 @@ from fake_useragent import UserAgent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
import types
|
||||||
|
|
||||||
|
|
||||||
def tor_profile():
|
def tor_profile():
|
||||||
|
|
@ -31,6 +32,13 @@ def install_har_export_trigger(driver):
|
||||||
return driver
|
return driver
|
||||||
|
|
||||||
|
|
||||||
|
def har_data(self):
|
||||||
|
return self.execute_async_script(
|
||||||
|
"HAR.triggerExport().then(arguments[0]);"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Grattoir(object):
|
class Grattoir(object):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self._driver = None
|
self._driver = None
|
||||||
|
|
@ -45,6 +53,7 @@ class Grattoir(object):
|
||||||
o.binary = binary
|
o.binary = binary
|
||||||
self._driver = firefox.webdriver.WebDriver(options=o)
|
self._driver = firefox.webdriver.WebDriver(options=o)
|
||||||
self._driver = install_har_export_trigger(self._driver)
|
self._driver = install_har_export_trigger(self._driver)
|
||||||
|
self._driver.har_data = types.MethodType(har_data, self._driver)
|
||||||
return self._driver
|
return self._driver
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_tb):
|
def __exit__(self, exc_type, exc_value, exc_tb):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue