kazurayam / chromedriverfactory

A Java library that enables you to launch Selenium ChromeDriver using an existing user Profile. That let you to carry cookies over multiple HTTP sessions via user Profile.
0 stars 0 forks source link

a quick method that returns a list of ChromeUserProfiles in JSON #76

Open kazurayam opened 6 months ago

kazurayam commented 6 months ago

It would be nice to have that.

kazurayam commented 6 months ago

Since v0.7.0, we are able to do this already:

        @Test
    void test_allChromeUserProfileAsString() {
        String text = ChromeProfileUtils.allChromeUserProfilesAsString()
        logger.debug("[test_allChromeUserProfileAsString] text: " + text)
        assertTrue( text.length() > 0)
    }

See Line #43 https://github.com/kazurayam/chromedriverfactory/blob/0.7.3/src/test/groovy/com/kazurayam/webdriverfactory/chrome/ChromeProfileUtilsTest.groovy

Output:

[Test worker] INFO com.kazurayam.webdriverfactory.chrome.ChromeProfileUtilsTest - [test_allChromeUserProfileAsString] text: [
    {"userProfile":"Kazuaki","userDataDir":"/Users/kazurayam/Library/Application Support/Google/Chrome","cacheDirectoryName":"Default"},
    {"userProfile":"Picasso","userDataDir":"/Users/kazurayam/Library/Application Support/Google/Chrome","cacheDirectoryName":"Profile 17"}
]
kazurayam commented 6 months ago

ChromeProfileUtils class implements a method that returns List<ChromeUserProfile>

public static List<ChromeUserProfile> getChromeUserProfileList() throws IOException

and

public static List<ChromeUserProfile> getChromeUserProfileList(final Path userDataDir) throws IOException