@Test public void shouldProvideFlashDriver() { FlashWebDriverProvider provider = new FlashWebDriverProvider("flashObjectId", new FirefoxDriver()); provider.initialize(); assertThat(provider.get(), instanceOf(FlashDriver.class)); FlashPage page = new FlashPage(provider) {}; assertThat(page.flashDriver(), notNullValue()); provider.get().quit(); }
@Test(expected = FlashNotSupported.class) public void shouldThrowAnExceptionIfWebDriverDoesNotSupportFlash() { final WebDriver driver = Mockito.mock(WebDriver.class); WebDriverProvider provider = new DelegatingWebDriverProvider() { public void initialize() { this.delegate.set(driver); } }; provider.initialize(); FlashPage page = new FlashPage(provider) {}; page.flashDriver(); }