Open enflo opened 2 years ago
Thanks for raising this.
Is your Celery task just importing SELENIUM_CHROME_DRIVER
from the config file? Does it make any difference if you move the creation of the driver to inside the task - just above where the code uses it? I'm just trying to understand whether having the driver external to the task (assuming it is) is causing the problem.
The same is happening here, and put the creation of the driver inside the task, but still only empty list in driver.requests
I have the driver generated in a file and I import it. I also tried moving the driver code into the Celery task, but the error is the same.
It's normal. You should define selenium wire machine address in your config. What does it mean ? It means: where your code is executed exactly
So it's potentially your celery container.
Ex:
seleniumwire_options_dict = {
"auto_config": False,
"addr": [SELENIUM_WIRE_MACHINE_IP],
}
If your containers are connected in swarm, you can use directly your celery container name as hostname or localhost if you do some test locally.
driver = webdriver.Chrome(
**,
seleniumwire_options=seleniumwire_options_dict,
)
After performing a driver.get() to a URL, through a Celery task the value of driver.requests is always a empty list. If I make the same call from python driver.requests it does have the values.
Any ideas?
SELENIUM CONFIG FILE
Code example: