Search in sources :

Example 1 with Capabilities

use of org.openqa.selenium.Capabilities in project spring-boot by spring-projects.

the class LocalHostWebConnectionHtmlUnitDriverTests method createWithCapabilitiesWhenEnvironmentIsNullWillThrowException.

@Test
public void createWithCapabilitiesWhenEnvironmentIsNullWillThrowException() throws Exception {
    this.thrown.expect(IllegalArgumentException.class);
    this.thrown.expectMessage("Environment must not be null");
    Capabilities capabilities = mock(Capabilities.class);
    given(capabilities.getBrowserName()).willReturn("chrome");
    new LocalHostWebConnectionHtmlUnitDriver(null, capabilities);
}
Also used : Capabilities(org.openqa.selenium.Capabilities) Test(org.junit.Test)

Example 2 with Capabilities

use of org.openqa.selenium.Capabilities in project fess by codelibs.

the class WebDriverGenerator method startWebDriver.

protected void startWebDriver() {
    try {
        if (webDriver == null) {
            if (webDriverCapabilities == null) {
                webDriver = new PhantomJSDriver();
            } else {
                if (webDriverCapabilities instanceof DesiredCapabilities) {
                    final DesiredCapabilities capabilities = (DesiredCapabilities) webDriverCapabilities;
                    webDriverCapabilities.asMap().entrySet().stream().filter(e -> e.getValue() instanceof String && filePathMap.containsKey(e.getValue().toString())).forEach(e -> capabilities.setCapability(e.getKey(), filePathMap.get(e.getValue().toString())));
                }
                webDriver = new PhantomJSDriver(createDriverService(webDriverCapabilities), webDriverCapabilities);
            }
        }
        final FessConfig fessConfig = ComponentUtil.getFessConfig();
        webDriver.manage().window().setSize(new Dimension(fessConfig.getThumbnailHtmlPhantomjsWindowWidthAsInteger(), fessConfig.getThumbnailHtmlPhantomjsWindowHeightAsInteger()));
        previousCheckTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
    } catch (final Exception e) {
        if (logger.isDebugEnabled()) {
            logger.debug("WebDriver is not available for generating thumbnails.", e);
        } else {
            logger.info("WebDriver is not available for generating thumbnails.");
        }
    }
}
Also used : Rectangle(java.awt.Rectangle) OutputType(org.openqa.selenium.OutputType) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) WebDriver(org.openqa.selenium.WebDriver) Proxy(org.openqa.selenium.Proxy) LoggerFactory(org.slf4j.LoggerFactory) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) TakesScreenshot(org.openqa.selenium.TakesScreenshot) ImageIO(javax.imageio.ImageIO) Dimension(org.openqa.selenium.Dimension) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) ImageReader(javax.imageio.ImageReader) Proxies(org.openqa.selenium.browserlaunchers.Proxies) CommandLine(org.openqa.selenium.os.CommandLine) Builder(org.openqa.selenium.phantomjs.PhantomJSDriverService.Builder) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) BufferedImage(java.awt.image.BufferedImage) Collection(java.util.Collection) By(org.openqa.selenium.By) IOException(java.io.IOException) Capabilities(org.openqa.selenium.Capabilities) FileInputStream(java.io.FileInputStream) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) File(java.io.File) ImageInputStream(javax.imageio.stream.ImageInputStream) ImageReadParam(javax.imageio.ImageReadParam) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SessionNotFoundException(org.openqa.selenium.remote.SessionNotFoundException) PostConstruct(javax.annotation.PostConstruct) PhantomJSDriverService(org.openqa.selenium.phantomjs.PhantomJSDriverService) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Dimension(org.openqa.selenium.Dimension) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig) UnreachableBrowserException(org.openqa.selenium.remote.UnreachableBrowserException) IOException(java.io.IOException) SessionNotFoundException(org.openqa.selenium.remote.SessionNotFoundException)

Aggregations

Capabilities (org.openqa.selenium.Capabilities)2 Rectangle (java.awt.Rectangle)1 BufferedImage (java.awt.image.BufferedImage)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 PostConstruct (javax.annotation.PostConstruct)1 ImageIO (javax.imageio.ImageIO)1 ImageReadParam (javax.imageio.ImageReadParam)1 ImageReader (javax.imageio.ImageReader)1 ImageInputStream (javax.imageio.stream.ImageInputStream)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1 ComponentUtil (org.codelibs.fess.util.ComponentUtil)1 Test (org.junit.Test)1 By (org.openqa.selenium.By)1 Dimension (org.openqa.selenium.Dimension)1 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)1 OutputType (org.openqa.selenium.OutputType)1