Open Kuba314 opened 1 year ago
I have a similar issue, but only when trying to run the auth from an installed package -> then it fails with Can't connect to web browser. Please install Chrome, Chromium or Firefox
.
However, when I just clone the repo and run it locally with python3 lidlplus/__main__.py auth
it works smoothly and without issues.
I'm running it on maxOS Monterey 12.5.1, installing the package via pip.
I'd try to look into it more, but it's difficult to debug, as it runs without issues locally. Figured I would at least write it here to help someone.
Same problem here on my Linux box.
So I cloned the repo and tweaked it until it worked.
lidlplus
uses Selenium
. I'm also using Selenium
in other projects. So, this package was already installed.
However the minimal Selenium
program (two lines in a Python console) failed:
from selenium import webdriver
driver = webdriver.Firefox()
The geckodriver version (0.29.1) detected in PATH at /home/XXXX/bin/geckodriver might not be compatible with the detected firefox version (118.0.1); currently, geckodriver 0.33.0 is recommended for firefox 118.*, so it is advised to delete the driver in PATH and retry
The solution is simply enough: download the current geckodriver
from the Mozilla project and try again. The two-liner worked.
After that I changed the lidl-plus
source code in the file api.py
. In the procedure _init_firefox
I commented out three parameters that apparently don't exist anymore. (I tried using them in the two-liner and Python complained.)
return webdriver.Firefox(
# executable_path=GeckoDriverManager().install(),
# firefox_binary="/usr/bin/firefox",
options=options,
# firefox_profile=profile,
)
The superfluous parameters made the function call fail which was interpreted as "Firefox is not installed".
Please note that lidl-plus
tries to connect to Chrome first before it tries to connect to Firefox and the timeout is about half a minute. So, be patient.
I temporarily changed options.headless
to False
three lines earlier in order to see the Firefox window pop up and to observe the interaction. You have to remember however that the PIN that you get on your mobile has to be entered in the command line window not into Firefox.
lidl-plus
(with an -
)). lidlplus
(without the -
) and modify api.py
.lidlplus/__main__.py auth
lidlplus/__main__.py --language=de --country=DE --refresh-token=XXXXXX receipt --all > data.json
Will this work in a native app in headless mode? So far I was unsuccessful. It either fails to get a driver or selenium times out.
@adithya995 What exactly do you mean by "native app" and "headless mode"? What are the exact errors you're getting when you say "fails to get a driver" and "selenium times out"?
Describe the bug I'm not familiar with selenium at all, but
lidl-plus auth
was reporting that I don't have firefox installed (I do). Removingexecutable_path
,firefox_binary
andfirefox_profile
arguments fromwebdriver.Firefox()
in_init_firefox()
fixed this issue.Expected behavior I'm supposed to get a refresh token.
Environment (please complete the following information):