当前位置: 首页>>代码示例>>Java>>正文


Java LocalFileDetector类代码示例

本文整理汇总了Java中org.openqa.selenium.remote.LocalFileDetector的典型用法代码示例。如果您正苦于以下问题:Java LocalFileDetector类的具体用法?Java LocalFileDetector怎么用?Java LocalFileDetector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LocalFileDetector类属于org.openqa.selenium.remote包,在下文中一共展示了LocalFileDetector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSauce

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
protected static RemoteWebDriver createSauce ( final Platform os, final String browser, final String version ) throws MalformedURLException
{
    final DesiredCapabilities capabilities = new DesiredCapabilities ();
    capabilities.setBrowserName ( browser );
    if ( version != null )
    {
        capabilities.setVersion ( version );
    }
    capabilities.setCapability ( CapabilityType.PLATFORM, os );
    capabilities.setCapability ( CapabilityType.SUPPORTS_FINDING_BY_CSS, true );
    capabilities.setCapability ( "name", "Eclipse Package Drone Main Test" );

    if ( System.getenv ( "TRAVIS_JOB_NUMBER" ) != null )
    {
        capabilities.setCapability ( "tunnel-identifier", System.getenv ( "TRAVIS_JOB_NUMBER" ) );
        capabilities.setCapability ( "build", System.getenv ( "TRAVIS_BUILD_NUMBER" ) );
        capabilities.setCapability ( "tags", new String[] { "CI" } );
    }

    final RemoteWebDriver driver = new RemoteWebDriver ( new URL ( String.format ( "http://%s:%[email protected]%s/wd/hub", SAUCE_USER_NAME, SAUCE_ACCESS_KEY, SAUCE_URL ) ), capabilities );

    driver.setFileDetector ( new LocalFileDetector () );

    return driver;
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:26,代码来源:TestSuite.java

示例2: createSauce

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
protected static RemoteWebDriver createSauce ( final Platform os, final String browser, final String version ) throws MalformedURLException
{
    final DesiredCapabilities capabilities = new DesiredCapabilities ();
    capabilities.setCapability ( CapabilityType.BROWSER_NAME, browser );
    if ( version != null )
    {
        capabilities.setCapability ( CapabilityType.VERSION, version );
    }
    capabilities.setCapability ( CapabilityType.PLATFORM, os );
    capabilities.setCapability ( "name", "Package Drone Main Test" );

    final RemoteWebDriver driver = new RemoteWebDriver ( new URL ( String.format ( "http://%s:%[email protected]:80/wd/hub", SAUCE_USER_NAME, SAUCE_ACCESS_KEY ) ), capabilities );

    driver.setFileDetector ( new LocalFileDetector () );

    return driver;
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:18,代码来源:TestSuite.java

示例3: getWebDriverInstance

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public WebDriver getWebDriverInstance() {
	WebDriver retVal = getWebDriver();
	if (null == retVal || !(((EventFiringWebDriver)retVal).getWrappedDriver() instanceof RemoteWebDriver)) {
		
		try {
			RemoteWebDriver remoteVal = new RemoteWebDriver(new URL(url), caps.get());
			remoteVal.setFileDetector(new LocalFileDetector());
			retVal = remoteVal;
		} catch (MalformedURLException e) {
			//TODO add handling for bad url
			e.printStackTrace();
		}
		
		setWebDriver(retVal);
	}
	return retVal;

}
 
开发者ID:bigtester,项目名称:automation-test-engine,代码行数:23,代码来源:MyRemoteDriver.java

示例4: uploadFile

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
@Monitor
@RetryFailure(retryCount=3)
@JSHandle
public WebDriverController uploadFile(Object locator, String path) {
    LocalFileDetector detector = new LocalFileDetector();
    File localFile = detector.getLocalFile(path);
    ((RemoteWebElement)waitController().waitForElementPresence(locator)).setFileDetector(detector);
    waitController().waitForElementPresence(locator).sendKeys(localFile.getAbsolutePath());
    return this;
}
 
开发者ID:GiannisPapadakis,项目名称:seletest,代码行数:12,代码来源:WebDriverController.java

示例5: postConstruct

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public void postConstruct(D webDriver) {
    if (webDriver instanceof RemoteWebDriver) {
        try {
            ((RemoteWebDriver) webDriver).setFileDetector(new LocalFileDetector());
        } catch (WebDriverException e) {
            String message = e.getMessage();
            if (message != null &&
                    !message.contains(NO_FILE_DETECTOR_NEEDED)) {
                throw e;
            }
        }
    }
}
 
开发者ID:willhaben,项目名称:willtest,代码行数:15,代码来源:FileDetectorConfigurator.java

示例6: cleanValueToSend

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
/**
 * When send keys is being executed in a input file=type {@link LocalFileDetector} must be configured for remote drivers. Additionally,
 * the file path is expanded to be absolute
 *
 * @param driver used to run commands
 * @param element receiving keys
 * @param value to be set to input file type
 * @return value expanded to absolute path if for input file type.
 */
private String cleanValueToSend(WebDriver driver, WebElement element, String value) {
	if (!StringUtils.equals(element.getAttribute(SeleniumFixture.INPUT_TYPE_ATTRIBUTE), SeleniumFixture.INPUT_TYPE_FILE_VALUE)) {
		return this.fitnesseMarkup.clean(value);
	}
	// set file detector for remote web elements. Local FirefoxDriver uses RemoteWebElement and
	if (element instanceof RemoteWebElement && !ClassUtils.isAssignable(driver.getClass(), FirefoxDriver.class)) {
		((RemoteWebElement) element).setFileDetector(new LocalFileDetector());
	}
	return this.fitnesseMarkup.cleanFile(value).getAbsolutePath();
}
 
开发者ID:andreptb,项目名称:fitnesse-selenium-slim,代码行数:20,代码来源:SeleniumFixture.java

示例7: getSeleniumGridRemoteDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
private static WebDriver getSeleniumGridRemoteDriver() throws MalformedURLException {
	final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
	desiredCapabilities.setBrowserName(System.getProperty("selenium.grid.browser", "firefox"));
	desiredCapabilities.setVersion(System.getProperty("selenium.grid.version", ""));
	desiredCapabilities.setPlatform(Platform.ANY);

	final URL url = new URL("http", System.getProperty("selenium.grid"), Integer.valueOf(System.getProperty(
			"selenium.grid.port", "4444")), "/wd/hub");

	final RemoteWebDriver remoteWebDriver = new RemoteWebDriver(url,
			desiredCapabilities);
	remoteWebDriver.setFileDetector(new LocalFileDetector());
	return new Augmenter().augment(remoteWebDriver);
}
 
开发者ID:orionhealth,项目名称:XBDD,代码行数:15,代码来源:XbddDriver.java

示例8: getWebDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public WebDriver getWebDriver(SupportedBrowser browserType) {
	RemoteWebDriver remoteDriver = new RemoteWebDriver(gridHubURL,
			desiredCapabilities, browserType.toCapabilities());
	remoteDriver.setFileDetector(new LocalFileDetector());
	return remoteDriver;
}
 
开发者ID:alb-i986,项目名称:selenium-tinafw,代码行数:8,代码来源:WebDriverFactoryRemote.java

示例9: createDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public T createDriver() {
    T remoteWebDriver = constr.apply(url, capabilities);
    FileDetector fd = remoteWebDriver.getFileDetector();
    if (fd == null || fd instanceof UselessFileDetector) {
        remoteWebDriver.setFileDetector(new LocalFileDetector());
    }
    Environment.getInstance().setSymbol(REMOTE_URL_KEY, url.toString());
    return remoteWebDriver;
}
 
开发者ID:fhoeben,项目名称:hsac-fitnesse-fixtures,代码行数:11,代码来源:RemoteDriverFactory.java

示例10: webDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Bean
public WebDriver webDriver() {
    PhantomJsDriverManager.getInstance().version("2.1.1").arch64().setup();

    final PhantomJSDriver phantomJSDriver = new PhantomJSDriver();
    phantomJSDriver.setFileDetector(new LocalFileDetector());
    return phantomJSDriver;
}
 
开发者ID:KyleRogers,项目名称:cylus,代码行数:9,代码来源:AcceptanceTestConfig.java

示例11: create

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
public WebDriver create(WebDriverProperties webDriverProperties) throws IOException {
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities(webDriverProperties.getDesiredCapabilities());
    desiredCapabilities.merge(browserSpecificCapabilities(webDriverProperties));

    WebDriver webDriver = null;
    if (webDriverProperties.getUrl() != null) {
        RemoteWebDriver remoteDriver = new RemoteWebDriver(webDriverProperties.getUrl(), desiredCapabilities);
        remoteDriver.setFileDetector(new LocalFileDetector());
        webDriver = remoteDriver;
    } else {
        String browserName = desiredCapabilities == null ? null : desiredCapabilities.getBrowserName();
        if (Strings.isNullOrEmpty(browserName)) browserName = BrowserType.CHROME;
        webDriver = WebDriverType.typeFor(browserName).create(this, desiredCapabilities);
    }

    WindowProperties window = webDriverProperties.getWindow();
    if (window != null) {
        DimensionProperties size = window.getSize();
        PointProperties position = window.getPosition();
        if (size != null) webDriver.manage().window().setSize(new Dimension(size.getWidth(), size.getHeight()));
        if (position != null) webDriver.manage().window().setPosition(new Point(position.getX(), position.getY()));
        if (window.isMaximized()) {
            webDriver.manage().window().maximize();
        }
    }

    webDriver = webDriver instanceof TakesScreenshot ? webDriver : new Augmenter().augment(webDriver);
    for (WebDriverTransformer transformer : driverServices.getWebDriverTranformers()) webDriver = transformer.transform(webDriver);
    return webDriverProperties.isStateful() ? new StatefulWebDriver(webDriver) : webDriver;
}
 
开发者ID:viltgroup,项目名称:minium,代码行数:31,代码来源:WebDriverFactory.java

示例12: createDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public WebDriver createDriver(URL remoteUrl) throws IOException {
    if (isRemoteDriver()) {
        RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, DesiredCapabilities.htmlUnit());
        driver.setFileDetector(new LocalFileDetector());
        return driver;
    } else {
        return createDriver();
    }
}
 
开发者ID:sdl,项目名称:Testy,代码行数:11,代码来源:HtmlUnitConfigReader.java

示例13: createDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public WebDriver createDriver(URL remoteUrl) throws IOException {
    FirefoxOptions options = getFirefoxOptions();
    if (isRemoteDriver()) {
        RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, options);
        driver.setFileDetector(new LocalFileDetector());
        return driver;
    } else {
        return new FirefoxDriver(options);
    }
}
 
开发者ID:sdl,项目名称:Testy,代码行数:12,代码来源:FirefoxConfigReader.java

示例14: createDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public WebDriver createDriver(URL remoteUrl) throws IOException {
    ChromeOptions options = getChromeOptions();
    if (isRemoteDriver()) {
        RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, options);
        driver.setFileDetector(new LocalFileDetector());
        return driver;
    } else {
        return new ChromeDriver(options);
    }
}
 
开发者ID:sdl,项目名称:Testy,代码行数:12,代码来源:ChromeConfigReader.java

示例15: createDriver

import org.openqa.selenium.remote.LocalFileDetector; //导入依赖的package包/类
@Override
public WebDriver createDriver(URL remoteUrl) throws IOException {
    InternetExplorerOptions capabilities = getOptions();
    if (isRemoteDriver()) {
        RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, capabilities);
        driver.setFileDetector(new LocalFileDetector());
        return driver;
    } else {
        return new InternetExplorerDriver(capabilities);
    }
}
 
开发者ID:sdl,项目名称:Testy,代码行数:12,代码来源:IExplorerConfigReader.java


注:本文中的org.openqa.selenium.remote.LocalFileDetector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。