better install procedure
parent
88511b62aa
commit
0eedf00c5d
|
|
@ -1,6 +1,7 @@
|
||||||
from selenium.webdriver import firefox
|
from selenium.webdriver import firefox
|
||||||
from fake_useragent import UserAgent
|
from fake_useragent import UserAgent
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -21,6 +22,15 @@ def tor_browser_binary_path():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def install_har_export_trigger(driver):
|
||||||
|
with importlib.resources.path(
|
||||||
|
__package__,
|
||||||
|
"assets/har_export_trigger-0.6.2resigned1.xpi",
|
||||||
|
) as p:
|
||||||
|
driver.install_addon(p.as_uri())
|
||||||
|
return driver
|
||||||
|
|
||||||
|
|
||||||
class Grattoir(object):
|
class Grattoir(object):
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self._driver = None
|
self._driver = None
|
||||||
|
|
@ -34,7 +44,7 @@ class Grattoir(object):
|
||||||
o.profile = profile
|
o.profile = profile
|
||||||
o.binary = binary
|
o.binary = binary
|
||||||
self._driver = firefox.webdriver.WebDriver(options=o)
|
self._driver = firefox.webdriver.WebDriver(options=o)
|
||||||
self._driver.install_addon("assets/har_export_trigger-0.6.2resigned1.xpi")
|
self._driver = install_har_export_trigger(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