Closed kazurayam closed 2 years ago
Example
@Test
void test_ChromeDriver_metadata_stuffed() {
ChromeDriverFactory cdFactory = ChromeDriverFactory.newChromeDriverFactory()
driver = cdFactory.newChromeDriver(new ProfileDirectoryName('Default'))
assertNotNull(driver)
assertTrue(driver.userProfile.isPresent())
assertTrue(driver.userDataAccess.isPresent())
driver.userProfile.ifPresent({ ChromeUserProfile up ->
println up
assertEquals(new UserProfile("Kazuaki"), up.getUserProfile())
assertEquals(new ProfileDirectoryName("Default"), up.getProfileDirectoryName())
assertTrue(Files.exists(up.getUserDataDir()))
// e.g, "/Users/kazurayam/Library/Application Support/Google/Chrome"
})
}
I can create an instance of ChromeDriver using com.kazurayam.webdriverfactory.chrome.ChromeDriverFactory while specifying
I want to retrieve these attributes out of the ChromeDriver instance. It is useful for various reporting/diagnostics purposes.
I can dynamically add attributes to ChromeDriver instance using Groovy's Metaprogramming Technique.