Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 6

running selenium-side-runner with a chrome profile.

Dear GitHub community,

I have been desperately trying to run selenium-side-runner with a specific Google Chrome profile, using the command line switch user-data-dir

I'm on Windows 7 64 bits.

Unfortunately, after every trial, chrome://version shows that the profile directory is a temporary one (default behaviour of chromedriver).

Here's what I tried :

  • using slashes in data directory path: selenium-side-runner -c "chromeOptions.args=[user-data-dir=C:/Users/LeNoVo/AppData/Local/Google/Chrome/User Data/Profile 1]" -c "chromeOptions.args=[fake-arg]" c:\Users\Me\path\demo.side
  • using back-slashes in data dir path: selenium-side-runner -c "chromeOptions.args=[user-data-dir=C:\Users\LeNoVo\AppData\Local\Google\Chrome\User Data\Profile 1]" -c "chromeOptions.args=[fake-arg]" c:\Users\Me\path\demo.side
  • using two back-slashes: selenium-side-runner -c "chromeOptions.args=[user-data-dir=C:\\Users\\LeNoVo\\AppData\\Local\\Google\\Chrome\\User Data\Profile 1]" -c "chromeOptions.args=[fake-arg]" c:\Users\Me\path\demo.side
  • I also did all of the above, but with the data dir path stopping at \User Data , plus the argument -c "chromeOptions.args=[profile-directory="Profile 1"]"

 

Note: the "fake-arg" turns out to be necessary, because webdriver (or selenium-side-runner) expects arguments to be an array, not a single string. So I include that fake-arg to overcome that issue.

 

Any help would be appreciated.

Thank you in advance.

 

5 Replies
Commander Lvl 2
Message 2 of 6

Re: running selenium-side-runner with a chrome profile.

According to this answer on SO, you can also define this profile in the code itself. Wouldn't that be easier to do?


- Mark
Copilot Lvl 3
Message 3 of 6

Re: running selenium-side-runner with a chrome profile.

You mean by the command line option profile-directory="Profile 1"  ?

I tried that , it didn't work.

 

I'm not sure what you mean by "the code itself".

You mean I open the .side file and edit it ?

Commander Lvl 2
Message 4 of 6

Re: running selenium-side-runner with a chrome profile.

With "the code itself" I meant your test cases in Selenium which you have written in (for example) Python or JavaScript. I was referring to this code snippet:

m_Options = new ChromeOptions();
m_Options.AddArgument("--user-data-dir=C:/Users/Me/AppData/Local/Google/Chrome/User Data/Default");
m_Options.AddArgument("--disable-extensions");
m_Driver = new ChromeDriver(@"pathtoexe", m_Options);
m_Driver.Navigate().GoToUrl("somesite");

on the SO answer. Could you try to incorporate this into your test cases?

 

Also what's up with the fake-arg?


- Mark
Copilot Lvl 3
Message 5 of 6

Re: running selenium-side-runner with a chrome profile.

Thank you.

  • I tried to incorporate that snippet using "execute script" command of Selenium IDE.

However, it did not work.

selenium-side-runner encountered an error : 

WebDriverError: unknown error: ChromeOptions is not defined

  • Concerning "fake-arg" , I found that solution in SO, too :

https://stackoverflow.com/a/43597701/10817945

(look at the bottom of the answer)

Commander Lvl 2
Message 6 of 6

Re: running selenium-side-runner with a chrome profile.

Well, I can't really tell what is going wrong there then...

 

If you don't get enough engagement on your post here, you could consider asking your question, for example, here: https://groups.google.com/forum/#!forum/selenium-users . You could even link this thread here.


- Mark