Skip to content

Commit 202cce4

Browse files
committed
Try different chrome versions
1 parent c838f93 commit 202cce4

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ After we have received the token once, we can use it for further requestes and w
2626
- Chromium
2727
- Google Chrome
2828
- Mozilla Firefox
29+
- Microsoft Edge
2930
* Install additional python packages
3031
```bash
3132
pip install "lidl-plus[auth]"

lidlplus/api.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
from getuseragent import UserAgent
2121
from oic.oic import Client
2222
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
23-
from selenium.webdriver.chrome.service import Service as ChromeService
23+
from selenium.webdriver.chrome.service import Service
2424
from selenium.webdriver.common.by import By
2525
from selenium.webdriver.support import expected_conditions
2626
from selenium.webdriver.support.ui import WebDriverWait
2727
from seleniumwire import webdriver
2828
from seleniumwire.utils import decode
2929
from webdriver_manager.chrome import ChromeDriverManager
3030
from webdriver_manager.firefox import GeckoDriverManager
31+
from webdriver_manager.core.os_manager import ChromeType
3132
except ImportError:
3233
pass
3334

@@ -87,7 +88,13 @@ def _init_chrome(self, headless=True):
8788
if headless:
8889
options.add_argument("headless")
8990
options.add_experimental_option("mobileEmulation", {"userAgent": user_agent})
90-
return webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=options)
91+
for chrome_type in [ChromeType.GOOGLE, ChromeType.MSEDGE, ChromeType.CHROMIUM]:
92+
try:
93+
service = Service(ChromeDriverManager(chrome_type=chrome_type).install())
94+
return webdriver.Chrome(service=service, options=options)
95+
except AttributeError:
96+
continue
97+
raise WebBrowserException("Unable to find a suitable Chrome driver")
9198

9299
def _init_firefox(self, headless=True):
93100
user_agent = UserAgent(self._OS.lower()).Random()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
setup(
1313
name="lidl-plus",
14-
version="0.3.2",
14+
version="0.3.4",
1515
author="Andre Basche",
1616
description="Fetch receipts and more from Lidl Plus",
1717
long_description=long_description,

0 commit comments

Comments
 (0)