Does anyone have a list of options that can be used and the correct syntax when setting CHROMEDRIVER_OPTIONS variables? From the available examples, setting it up to maximize the screen (--start-maximized) works fine. But I am trying to use other possible chrome options (which might not be supported by Macro Scheduler) and I am getting the following line error:
Line xx - (1:1) Unquoted string in JSON data only valid for dictionary names.
The option I am trying to set is "user-data-dir" option with the following lines:
Let>CHROMEDRIVER_EXE=%SCRIPT_DIR%\ChromeDriver\chromedriver.exe
Let>CHROMEDRIVER_OPTIONS=--user-data-dir="C:\Users\id1"
ChromeStart>session_id
Is my syntax wrong or are the commands allowed by this variable limited. I have tried different variations with the quotes and nothing seems to work here.
Thanks
Gary
CHROMEDRIVER_OPTIONS Syntax
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 51
- Joined: Tue Oct 03, 2006 4:22 pm
- Location: Akron, Ohio
- Contact:
- Grovkillen
- Automation Wizard
- Posts: 1030
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: CHROMEDRIVER_OPTIONS Syntax
I haven't been able to set the download path. I've since come to use the default download path and just copy the files from there to wherever I want.
Re: CHROMEDRIVER_OPTIONS Syntax
Actually, is a startup switch that tells chrome to open a specific user profile rather than the default blank profile.
I spoke to Marcus about this switch back in October 2020 and was told:
@Marcus_Tettmar are we configuring this switch incorrectly or is it broken? If it works, could you share an example of how to configure the flag and file path?
Code: Select all
user-data-dir=
I spoke to Marcus about this switch back in October 2020 and was told:
Having tried this myself, I cannot get this startup switch to work.I think you mean CHROMEDRIVER_OPTIONS which is just for startup switches. So you could do:
Let>CHROMEDRIVER_OPTIONS=--user-data-dir=/path/to/existing/profile
@Marcus_Tettmar are we configuring this switch incorrectly or is it broken? If it works, could you share an example of how to configure the flag and file path?
- Dorian (MJT support)
- Automation Wizard
- Posts: 1358
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: CHROMEDRIVER_OPTIONS Syntax
The solution seems to be rather convoluted.
Source : this post
The important part here is : "Chromedriver automatically adds "Default" to the end of "user-data-dir=."
So I followed the instructions from "2nd case" and adapted them for Macro Scheduler:
Created C:\Chrome_Profiles
Navigated to C:\Users\username\AppData\Local\Google\Chrome\User Data\Profile 1.
Copied Profile 1 folder to C:\Chrome_Profiles
Renamed "Profile 1" to "Default" - thus C:\Chrome_Profiles\Default
Seeing as ChromeDriver adds "Default" we can now just use this :
Thus : (tested and working)
Source : this post
The important part here is : "Chromedriver automatically adds "Default" to the end of "user-data-dir=."
So I followed the instructions from "2nd case" and adapted them for Macro Scheduler:
My Steps :2nd case: you're using another chrome profile (noted by Profile 1, Profile 2, etc. in chrome://version)
Navigate to that profile path. Should be something like C:\Users\david\AppData\Local\Google\Chrome\User Data\Profile 1.
Copy and paste that entire folder into whatever place you would like.(ex: D:\Chrome_Profiles). Your directory would look something like this: D:\Chrome_Profiles\Profile 1
Change Profile 1 to Default. Your directory will look something like this: D:\Chrome_Profiles\Default
Chromedriver automatically adds "Default" to the end of the options.add_argument(r"user-data-dir= part. Thus, you would just use:
options.add_argument(r"user-data-dir=D:\Chrome_Profiles") driver.get("https://www.facebook.com")
Created C:\Chrome_Profiles
Navigated to C:\Users\username\AppData\Local\Google\Chrome\User Data\Profile 1.
Copied Profile 1 folder to C:\Chrome_Profiles
Renamed "Profile 1" to "Default" - thus C:\Chrome_Profiles\Default
Seeing as ChromeDriver adds "Default" we can now just use this :
Code: Select all
Let>CHROMEDRIVER_OPTIONS=--user-data-dir=/Chrome_Profiles
Code: Select all
Let>TheURL=chrome://version/
Let>CHROMEDRIVER_EXE=c:\chromedriver.exe
Let>CHROMEDRIVER_OPTIONS=--user-data-dir=/Chrome_Profiles
KillProcess>chromedriver.exe
ChromeStart>session_id
ChromeNavigate>session_id,url,%TheURL%
Yes, we have a Custom Scripting Service. Message me or go here
Re: CHROMEDRIVER_OPTIONS Syntax
Thanks Dorian,
It's great to finally be able to use a defined and persistent chrome profile!
I tried something very similar a while back, but got an error relating to unquoted JSON strings that I was unable to resolve, in reflection it obviously relates to the file path, rather than being an issue with the flag itself. Is there a limitation that restricts the flag to C:\ drive? (My documents are on D:\, which means so is my %BMP_DIR% filepath)
It's great to finally be able to use a defined and persistent chrome profile!
I tried something very similar a while back, but got an error relating to unquoted JSON strings that I was unable to resolve, in reflection it obviously relates to the file path, rather than being an issue with the flag itself. Is there a limitation that restricts the flag to C:\ drive? (My documents are on D:\, which means so is my %BMP_DIR% filepath)
Code: Select all
Let>chrome_user_profile={"C:\Users\nickd\AppData\Local\Google\Chrome\User Data\Default"}
IfNotFileExists>%BMP_DIR%\Chrome_Profile
CopyFolder>%chrome_user_profile%,%BMP_DIR%\Chrome_Profile
Endif
Let>CHROMEDRIVER_OPTIONS=--user-data-dir=%BMP_DIR%\Chrome_Profile
- Dorian (MJT support)
- Automation Wizard
- Posts: 1358
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: CHROMEDRIVER_OPTIONS Syntax
There doesn't seem to be a limitation regarding location.
I used your script to copy over my Chrome Profile folder and was able to use this :
Note that you have \ instead of /.
I'm not sure why you're using your bmp_dir to store your Chrome Profile. Surely this folder may not always exist, as it's a subfolder created by the Image Recognition Wizard.
Are you attempting to set your download folder?
If so, once you have Let>CHROMEDRIVER_OPTIONS=--user-data-dir=wherever working, you could simply start up a session and then in >Settings >Advanced >Downloads change the download location. Then whenever you start an automated Chrome session using that profile it will be remembered.
I used your script to copy over my Chrome Profile folder and was able to use this :
Code: Select all
Let>CHROMEDRIVER_OPTIONS=--user-data-dir=d:/Chrome_Profile
I'm not sure why you're using your bmp_dir to store your Chrome Profile. Surely this folder may not always exist, as it's a subfolder created by the Image Recognition Wizard.
Are you attempting to set your download folder?
If so, once you have Let>CHROMEDRIVER_OPTIONS=--user-data-dir=wherever working, you could simply start up a session and then in >Settings >Advanced >Downloads change the download location. Then whenever you start an automated Chrome session using that profile it will be remembered.
Yes, we have a Custom Scripting Service. Message me or go here