aboutsummaryrefslogtreecommitdiff
path: root/src/ee/digikey
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-10-26 22:13:41 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2019-10-26 22:13:49 +0200
commit1c3b5f628b310c64f0da36247f5044d69b97d772 (patch)
treeb1d8b62d8f2e4d8c203281bef42e3c0c4e404971 /src/ee/digikey
parentd49e748f4605f26d5b65caea05773ea8a2dd0eb0 (diff)
downloadee-python-1c3b5f628b310c64f0da36247f5044d69b97d772.tar.gz
ee-python-1c3b5f628b310c64f0da36247f5044d69b97d772.tar.bz2
ee-python-1c3b5f628b310c64f0da36247f5044d69b97d772.tar.xz
ee-python-1c3b5f628b310c64f0da36247f5044d69b97d772.zip
digikey: Better webdriver creation.
Making the instantiation of the web driver a bit more generic, starting on making it possible to try out other browsers.
Diffstat (limited to 'src/ee/digikey')
-rw-r--r--src/ee/digikey/__init__.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ee/digikey/__init__.py b/src/ee/digikey/__init__.py
index cc57771..a9d49cd 100644
--- a/src/ee/digikey/__init__.py
+++ b/src/ee/digikey/__init__.py
@@ -11,10 +11,10 @@ from typing import List, Optional
from urllib.parse import urlparse, parse_qs
from lxml import html
-from selenium import webdriver
+from selenium.webdriver.remote.webdriver import WebDriver
import ee._utils
-from ee import EeException
+from ee import EeException, _utils
from ee.money import Money, get_default_context
from ee.part import Category
from ee.tools import mk_parents
@@ -261,7 +261,7 @@ class DigikeyClient(object):
self.baseurl = baseurl
self.on_download = on_download or self.__nop
self.cache = ee._utils.maybe_cache(cache_dir)
- self._driver: Optional[webdriver.Chrome] = None
+ self._driver: Optional[WebDriver] = None
def search(self, query: str) -> str:
return self.product_search(query)
@@ -344,10 +344,9 @@ class DigikeyClient(object):
return self._req(url, cache_key, params)
@property
- def driver(self) -> webdriver.Chrome:
+ def driver(self) -> WebDriver:
if self._driver is None:
- options = webdriver.ChromeOptions()
- self._driver = webdriver.Chrome(chrome_options=options)
+ self._driver = _utils.get_web_driver()
return self._driver