79206865

Date: 2024-11-20 10:55:12
Score: 2.5
Natty:
Report link

For who want to using "--user-data-dir=" and "--profile-directory=".

  1. "--user-data-dir=<Path_to_directory_on_your device>": this path must be exist, if it not exist, create it.

2."--profile-directory=<Name_Of_Folder>" :Any name you want to name: Defaul/Profile1/Profile3,... ,this folder will be created automatic when chrome instance is created.

Here is my example code using java. It's similar for python.

    ChromeOptions options = new ChromeOptions();
    userDataDir = "/home/myuser/userDataDir";
    try {
        File file = new File(userDataDir);
        if (!file.exists()) {
            Files.createDirectory(
                    Paths.get(userDataDir));
        }
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    createdUserDataDir = "--user-data-dir=" + userDataDir;
    createdProfileDir = "--profile-directory=" + "profileName";
    chromeOptions.addArguments(createdUserDataDir);
    chromeOptions.addArguments(createdProfileDir);

    WebDriver driver = new ChromeDriver(chromeOptions);
    driver.get("https:www.facebook.com")

Anyway, I customized "--user-data-dir=" and "--profile-directory=" to use different profiles on each instance of chrome, but this not solved the issue: maximum of attemps, try again later. Anyone worked out to pass this issue, please help bro.

Reasons:
  • RegEx Blacklisted phrase (3): please help
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: xnt4ever