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
Actually there seems something wrong using threading.threads and mp.processes, as well as asyncio or even in the main thread
when creating multiple drivers.
I don't know why i even bother since creating multiple drivers is useless and solves no problems.
chromedriver is just a messaging proxy passing messages back and forth. and 1 driver can control dozens of windows, each containing a magnitude of tabs (and is designed for that)
that having said
note: all the below has also been done using the (use_subprocess=True)
in Ipython this works fine:
drivers= [uc.Chrome() for_inrange(20) ]
however, when creating a file:
...
stuff
...
someotherstuff
...
if__name__=='__main__':
drivers= [uc.Chrome() for_inrange(10)]
input("press a key to exit")
thinking of a solution i tried modifying the code to put the path in a class variable when the first instance starts. but of course this won't work as it is not thread-safe.
workaround
So the ONLY solution for now (which is a bit cumbersome, so actually fits perfectly in creating multiple chromedrivers ;))
but does the job i :
putting the full path to your chrome BROWSER executable in the constructor
To address the problem, you can modify the code as follows:
drivers= [
uc.Chrome(
version_main=114, # Specify your browser versionbrowser_executable_path="/path/of/chrome", # Provide the path of the Chrome browserdriver_executable_path="path/uc/driver", # Specify the path of the UC driver
)
for_inrange(135)
]
To obtain the path of the UC driver, run a single instance chrome using UC. It will create the driver in a specific directory based on your operating system:
Windows: ~/appdata/roaming/undetected_chromedriver
Linux: ~/.local/share/undetected_chromedriver
Adjust the paths accordingly based on your system configuration.
Actually there seems something wrong using
threading.threads and mp.processes, as well as asyncio or even in the main threadwhen creating multiple drivers.
I don't know why i even bother since creating multiple drivers is useless and solves no problems.
chromedriver is just a messaging proxy passing messages back and forth. and 1 driver can control dozens of windows, each containing a magnitude of tabs (and is designed for that)
that having said
note: all the below has also been done using the (use_subprocess=True)
in Ipython this works fine:
however, when creating a file:
running this file yields:
thinking of a solution i tried modifying the code to put the path in a class variable when the first instance starts. but of course this won't work as it is not thread-safe.
workaround
So the ONLY solution for now (which is a bit cumbersome, so actually fits perfectly in creating multiple chromedrivers ;))
but does the job i :
putting the full path to your chrome BROWSER executable in the constructor
like so
Raising this as an issue since that is hip
(and I don't yet started documentation, nor know where to start, nor have time). so this is FYI
The text was updated successfully, but these errors were encountered: