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

1

1 Answer 1

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
3
  • 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 Mar 1, 2020 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 1, 2020 at 19:24
  • Thank you. I created a new profile and copied all content from Default folder to new profile. Problem Solved! Mar 1, 2020 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.