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

ChromeUserProfile object should have a attribute that tells if the cache directory is present on disk or not #77

Open kazurayam opened 6 months ago

kazurayam commented 6 months ago

ChromeUserProfile#getChromeUserProfileList() returns a List, which is in fact an extract of the Local State file in the UserDataDir.

[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"}
]

There will be the folders of Defalul and Profile 17 in the genuine UserDataDir.

However, there could be a case that the Profile 17 is found in the Local State file but actually there is no Profile 17 folder in the generated UserDataDir. This could be a case where the UserDataDir was dynamically created by ChromeUserProfile.newChromeDriver() with UserDataAccess.TO_GO.

So I want to distiguish such case:

[Test worker] INFO com.kazurayam.webdriverfactory.chrome.ChromeProfileUtilsTest - [test_allChromeUserProfileAsString] text: [
    {"userProfile":"Kazuaki","userDataDir":<some temporary directory>,"cacheDirectoryName":"Default", 
            isPresent:true },
    {"userProfile":"Picasso","userDataDir":<some temporary directory>,"cacheDirectoryName":"Profile 17",
            isPresent:false }
]