You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've written a class that automatically starts a new instance (and should be instantiating new chromeOptions) every time the Bot.run() command is called
fromseleniumbaseimportSBclassBot():
defrun(self):
withSB(uc=True, user_data_dir=self.user_data_dir_path) assb:
# program code
This code works fine when I run it locally in venv, however it does not work when running the same code in a docker container with a mounted /used_data_dir volume (self.user_data_dir_path) for persistency.
Some additional findings I've discovered while testing:
In docker, the code works fine for the first run when the user_data_dir does not yet exist
In docker, the code works for additional runs leveraging the user_data_dir that gets created from the initial run if the container has not been stopped yet
If the container is restarted (docker restart or docker stop && docker start) the code still works
Only when the container is destroyed and then spun up again (docker down && docker up) does the "You cannot reuse the ChromeOptions object" error get thrown
Could you please help me understand why I am experiencing this behavior and how to resolve?
I recognize SeleniumBase is a separate repo I am leveraging, however the maintainer of that repo has sent me here as it seems to be the undetected_chromedriver portion that is throwing the error
I saw #555, however because the above context manager recreates a new instance every time and this code does work in venv and not docker, do not think its related.
Thanks in advance!
Dockerfie:
FROM ghcr.io/cascandaliato/seleniumbase:master
# Install necessary packagesRUN apt-get update && \
apt-get install --yes git ffmpeg
# Copy main application code into the root directoryCOPY . /
# Install Python dependencies for the main applicationRUN pip install -U pip && pip install -r requirements.txt
ENTRYPOINT ["python3", "main.py"]
I've written a class that automatically starts a new instance (and should be instantiating new chromeOptions) every time the
Bot.run()
command is calledThis code works fine when I run it locally in venv, however it does not work when running the same code in a docker container with a mounted /used_data_dir volume (self.user_data_dir_path) for persistency.
Some additional findings I've discovered while testing:
docker restart
ordocker stop && docker start
) the code still worksdocker down && docker up
) does the "You cannot reuse the ChromeOptions object" error get thrownCould you please help me understand why I am experiencing this behavior and how to resolve?
I recognize SeleniumBase is a separate repo I am leveraging, however the maintainer of that repo has sent me here as it seems to be the undetected_chromedriver portion that is throwing the error
I saw #555, however because the above context manager recreates a new instance every time and this code does work in venv and not docker, do not think its related.
Thanks in advance!
Dockerfie:
docker-compose.yml:
The text was updated successfully, but these errors were encountered: