1

I'm trying to set a profile in chrome, but it does not work.

Chrome Version: Version 80.0.3987.106

WebDriver: ChromeDriver 80.0.3987.106

Selenium Basic: SeleniumBasic-2.0.9.0.exe

Option Explicit
Public Sub openGChrome()
    Dim obj As New WebDriver
    Dim i As Integer

    Const URL = "https://www.linkedin.com/feed/"
    Const JS_PROFILE As String = "C:\Users\ChuckNorris\AppData\Local\Google\Chrome\User Data\Default"
    Set obj = New ChromeDriver
    With obj
        .SetProfile JS_PROFILE, True
        .Get URL
         Stop
        .Quit
    End With
End Sub

What i'm doing wrong? Any help?

Edit: The browser open, but i dont have any profile select, i can't login to websites without signin

Juan.Queiroz
  • 207
  • 1
  • 3
  • 13
  • check this about 32/64 bit https://stackoverflow.com/questions/57216623/using-google-chrome-in-selenium-vba-installation-steps – lauda Mar 01 '20 at 16:57

1 Answers1

1

You did not specify what "does not work", but I think you should take away the \Default from your profile path, because when you don't specify the name of the profile, meaning you want to use the default one, the \Default is then added implicitly.

To specify a certain profile other than the default, you would want to use:

.AddArgument ("profile-directory=foldername") 'foldername is the name of the folder with the profile you want to use
voxlmt
  • 11
  • 1
  • 1
    So close, the browser open with right profile, but i got the error: invalid argument user data directory is already in use please specify a unique value for --user-data-dir argument, or dont't use --user-data-dir – Juan.Queiroz Mar 01 '20 at 18:16
  • 3
    That's because you're already using the user data folder by having the browser open while opening another session with the same profile through selenium. So the solution is to either close the Chrome before starting your script, OR, create another profile and copy the user data folder to another location. Then use `AddArgument ("--user-data-dir=C:\location_of_the_user_data_folder")` and `AddArgument ("profile-directory=Name_of_the_profile_folder")` – voxlmt Mar 01 '20 at 19:24
  • Thank you. I created a new profile and copied all content from Default folder to new profile. Problem Solved! – Juan.Queiroz Mar 01 '20 at 19:32