Here's the issue i am facing now.
I could launch chrome driver. However my selenium code suddenly doesnt work and pops up above image.
Hope someone can shed light as i couldn't find a solution online. .
Generally BarthRid's answer is correct, providing full path to userdata folder works with Chrome 90+. But if you store userdata folder in the same directory as your script, you can use pathlib to manage things more easily.
import pathlib
script_directory = pathlib.Path().absolute()
options.add_argument(f"user-data-dir={script_directory}\\userdata")
This way allows you to store actual script's directory in a variable, and via formatted string put it in selenium's options argument. Useful while dealing with multiple instances.
I had a similar problem to yours and @scott degen. options.add_argument line of your pasted screenshot
I changed mine from:
options.add_argument("user-data-dir=selenium")
to the full directory, and it seems to be working better now.
options.add_argument("user-data-dir=C:\environments\selenium")
I changed mine from:
options.add_argument("user-data-dir=selenium")
to the full directory, and it seems to be working better now.
dir_path = os.getcwd()
chrome_option.add_argument(f'user-data-dir={dir_path}/selenium')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With