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


Java FirefoxBinary.setEnvironmentProperty方法代码示例

本文整理汇总了Java中org.openqa.selenium.firefox.FirefoxBinary.setEnvironmentProperty方法的典型用法代码示例。如果您正苦于以下问题:Java FirefoxBinary.setEnvironmentProperty方法的具体用法?Java FirefoxBinary.setEnvironmentProperty怎么用?Java FirefoxBinary.setEnvironmentProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openqa.selenium.firefox.FirefoxBinary的用法示例。


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

示例1: buildDriver

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
@BeforeClass
	public static void buildDriver() {
//		System.setProperty("webdriver.chrome.driver",
//				"/home/csokol/programas/chromedriver/chromedriver");
//		driver = new ChromeDriver();
		String localTest = System.getenv("LOCAL_TEST");
		if ("remote".equals(localTest)) {
			driver = ghostDriver();
		} else {
			FirefoxBinary firefox = new FirefoxBinary();
			String display = System.getProperty("DISPLAY", ":0");
			firefox.setEnvironmentProperty("DISPLAY", display);
			driver = new FirefoxDriver();
		}
		driver.manage().window().setSize(new Dimension(1280, 800));
		waitForFirstBodyPresence();
	}
 
开发者ID:caelum,项目名称:mamute,代码行数:18,代码来源:AcceptanceTestBase.java

示例2: makeObject

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
@Override
public FirefoxDriver makeObject() throws Exception {
    FirefoxBinary ffBinary = new FirefoxBinary();
    if (System.getProperty(DISPLAY_PROPERTY_KEY) != null) {
        Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + System.getProperty(DISPLAY_PROPERTY_KEY));
        ffBinary.setEnvironmentProperty("DISPLAY", System.getProperty(DISPLAY_PROPERTY_KEY));
    }
    FirefoxDriver fd = new FirefoxDriver(ffBinary, ProfileFactory.getInstance().getScenarioProfile());
    if (this.implicitelyWaitDriverTimeout != null) {
        fd.manage().timeouts().implicitlyWait(this.implicitelyWaitDriverTimeout.longValue(), TimeUnit.SECONDS);
    }
    if (this.pageLoadDriverTimeout != null) {
        fd.manage().timeouts().pageLoadTimeout(this.pageLoadDriverTimeout.longValue(), TimeUnit.SECONDS);
    }
    return fd;
}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:17,代码来源:FirefoxDriverPoolableObjectFactory.java

示例3: make

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
/**
 * 
 * @param config
 * @return A FirefoxDriver.
 */
@Override
public RemoteWebDriver make(HashMap<String, String> config) {
    FirefoxBinary ffBinary = new FirefoxBinary();
    if (System.getProperty(DISPLAY_PROPERTY) != null) {
        ffBinary.setEnvironmentProperty(
                DISPLAY_PROPERTY.toUpperCase(), 
                System.getProperty(DISPLAY_PROPERTY));
    } else if (System.getenv(DISPLAY_PROPERTY.toUpperCase()) != null) {
        ffBinary.setEnvironmentProperty(
                DISPLAY_PROPERTY.toUpperCase(), 
                System.getenv(DISPLAY_PROPERTY.toUpperCase()));
    }
    RemoteWebDriver remoteWebDriver = new FirefoxDriver(ffBinary, firefoxProfile);

    if (screenHeight != -1 && screenWidth!= -1) {
        remoteWebDriver.manage().window().setSize(new Dimension(screenWidth, screenHeight));
    }
    return remoteWebDriver;
}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:25,代码来源:FirefoxDriverFactory.java

示例4: createFirefoxDriver

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
private FirefoxDriver createFirefoxDriver(String display, String binaryPath,
        DesiredCapabilities desiredCapabilities)
{
    FirefoxProfile profile = createDefaultFirefoxProfile();
    FirefoxBinary binary = !StringUtils.isBlank(binaryPath) ? new FirefoxBinary(new File(binaryPath))
            : new FirefoxBinary();

    LOG.info("Binding to {} display", display);
    availableDisplays.compute(display, (d, value) -> value == null ? 1 : value + 1);
    binary.setEnvironmentProperty(DISPLAY, display);
    LOG.info("Firefox path is: {}", binaryPath);

    return openFirefoxDriver(desiredCapabilities, profile, binary);
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:15,代码来源:SeleniumDriver.java

示例5: getFirefoxDriver

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
private WebDriver getFirefoxDriver(String displayPort) {

		FirefoxDriver driver =  null;
		if(displayPort != null){
			FirefoxBinary binary = new FirefoxBinary();
			binary.setEnvironmentProperty("DISPLAY", displayPort);
			driver = new FirefoxDriver(binary,null); 
		}else{
			driver = new FirefoxDriver();
		}
		
		driver.manage().timeouts().implicitlyWait(DEFAULT_IMPLICITLY_WAIT_SECS, TimeUnit.SECONDS);
		driver.manage().timeouts().pageLoadTimeout(DEFAULT_PAGE_LOAD_TIMEOUT_SECS, TimeUnit.SECONDS);
		return driver; 
	}
 
开发者ID:geniussportsgroup,项目名称:plovr-maven-plugin,代码行数:16,代码来源:DriverProvider.java

示例6: getFirefoxDriver

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
/**
 * This methods creates a firefoxDriver instance and set a DISPLAY 
 * environment variable
 * @param display
 * @return an instance of firefoxDriver 
 */
public FirefoxDriver getFirefoxDriver(String display) {
    if (webDriver == null) {
        FirefoxBinary ffBinary = new FirefoxBinary();
        if (StringUtils.isNotBlank(display)) {
            Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + display);
            ffBinary.setEnvironmentProperty("DISPLAY", display);
        }
        ProfileFactory pf = ProfileFactory.getInstance();
        webDriver = new FirefoxDriver(ffBinary, pf.getOnlineProfile());
        webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        webDriver.manage().timeouts().pageLoadTimeout(310, TimeUnit.SECONDS);
    }
    return webDriver;
}
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:21,代码来源:WebDriverFactory.java

示例7: setDisplay

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
private void setDisplay(FirefoxBinary result) {
    String display = System.getProperty(DISPLAY_SYSTEM_PROPERTY_KEY);
    if (display != null) {
        result.setEnvironmentProperty("DISPLAY", display);
    }
}
 
开发者ID:willhaben,项目名称:willtest,代码行数:7,代码来源:DefaultFirefoxConfigurationParticipant.java

示例8: createWebDriver

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
/**
 *
 * @return the webdriver
 * @throws IOException if there is a problem loading the
 *                     properties file
 */
private WebDriver createWebDriver() throws IOException {
	Resource propertiesFile = new ClassPathResource(
			"META-INF/spring/application.properties");
	Properties properties = new Properties();
	properties.load(propertiesFile.getInputStream());
	String webdriverMode = properties.getProperty("selenium.webdriver.mode", "local");
	String driverName = properties.getProperty("selenium.webdriver.impl", "org.openqa.selenium.firefox.FirefoxDriver");
	WebDriverBrowserType browser = WebDriverBrowserType.fromString(driverName);
	String display = properties.getProperty("selenium.display.port", ":0");
	if (webdriverMode.equals("local")) {
		switch (browser) {
		case CHROME:
			String chromeLocation = properties
			.getProperty("selenium.webdriver.chromedriver.location");
			Map<String,String> environment = new HashMap<String,String>();
			environment.put("DISPLAY", display);
			ChromeDriverService chromeService = new ChromeDriverService.Builder()
			.usingDriverExecutable(new File(chromeLocation))
			.usingAnyFreePort().withEnvironment(environment).build();
			chromeService.start();
			return new RemoteWebDriver(chromeService.getUrl(),
					DesiredCapabilities.chrome());
		case SAFARI:
			return new SafariDriver();
		case INTERNET_EXPLORER:
			String 	internetExplorerLocation = properties
			.getProperty("selenium.webdriver.ie.location");
			InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService();
			ieService.start();
			return new RemoteWebDriver(ieService.getUrl(),
					DesiredCapabilities.internetExplorer());
		case FIREFOX:
		default:
			FirefoxBinary firefoxBinary = new FirefoxBinary();
			firefoxBinary.setEnvironmentProperty("DISPLAY", display);
			ProfilesIni allProfiles = new ProfilesIni();
			FirefoxProfile profile = allProfiles.getProfile("default");
			return new FirefoxDriver(firefoxBinary, profile);
		}
	} else {

		DesiredCapabilities capabilities = new DesiredCapabilities();
		switch (browser) {
		case CHROME:
			capabilities = DesiredCapabilities.chrome();
			break;
		case INTERNET_EXPLORER:
			capabilities = DesiredCapabilities.internetExplorer();
			break;
		case SAFARI:
			capabilities = DesiredCapabilities.safari();
			break;
		case FIREFOX:
		default:
			capabilities = DesiredCapabilities.firefox();
		}
		String platformName = properties.getProperty("selenium.webdriver.platformName", "LINUX");
		WebDriverPlatformType platform = WebDriverPlatformType.valueOf(platformName);
		switch (platform) {
		case MAC:
			capabilities.setPlatform(Platform.MAC);
			break;
		case WINDOWS:
			capabilities.setPlatform(Platform.WINDOWS);
			break;
		case LINUX:
		default:
			capabilities.setPlatform(Platform.LINUX);
		}
		return new RemoteWebDriver(new URL("http://build.e-monocot.org:4444/wd/hub"), capabilities);
	}
}
 
开发者ID:RBGKew,项目名称:eMonocot,代码行数:79,代码来源:WebDriverFacade.java

示例9: init

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
@Override
public FirefoxDriver init() {
    FirefoxBinary binary = new FirefoxBinary(new File("/opt/local/lib/firefox-x11/firefox-bin"));
    binary.setEnvironmentProperty("DISPLAY", ":88");
    return new FirefoxDriver(binary, new FirefoxProfile());
}
 
开发者ID:yujunliang,项目名称:seleniumcapsules,代码行数:7,代码来源:HeadlessFirefoxDriverSupplierOnLinux.java

示例10: get

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
@Override
public FirefoxDriver get() {
    FirefoxBinary binary = new FirefoxBinary(new File("/opt/local/lib/firefox-x11/firefox-bin"));
    binary.setEnvironmentProperty("DISPLAY", ":88");
    return new FirefoxDriver(binary, new FirefoxProfile());
}
 
开发者ID:yujunliang,项目名称:seleniumcapsules,代码行数:7,代码来源:HeadlessFirefoxDriverSupplierOnMacOs.java

示例11: initialize

import org.openqa.selenium.firefox.FirefoxBinary; //导入方法依赖的package包/类
/**
     *
     */
    private void initialize() {

        // Mysql access parameters are passed as JVM argument
//        dbUrl = System.getProperty(DB_URL_KEY);
//        dbName = System.getProperty(DB_NAME_KEY);
//        dbUser = System.getProperty(DB_USER_KEY);
//        dbPassword = System.getProperty(DB_PASSWORD_KEY);
//        initDb();

        // These parameters has to passed as JVM argument
        user = System.getProperty(USER_KEY);
        password = System.getProperty(PASSWORD_KEY);
        hostLocation = System.getProperty(HOST_LOCATION_KEY);
        xvfbDisplay = System.getProperty(XVFB_DISPLAY_KEY);

//        createRootUserInDb();

        ResourceBundle parametersBundle = ResourceBundle.getBundle(BUNDLE_NAME);
        userFieldName = parametersBundle.getString(USER_FIELD_NAME_KEY);
        passwordFieldName = parametersBundle.getString(PASSWORD_FIELD_NAME_KEY);
        loginUrl = hostLocation + parametersBundle.getString(LOGIN_URL_KEY);
        logoutUrl = hostLocation + parametersBundle.getString(LOGOUT_URL_KEY);
        adminUrl = hostLocation + parametersBundle.getString(ADMIN_URL_KEY);
        addUserUrl = hostLocation + parametersBundle.getString(ADD_USER_URL_KEY);
        editUserUrl = hostLocation + parametersBundle.getString(EDIT_USER_URL_KEY);
        deleteUserUrl = hostLocation + parametersBundle.getString(DELETE_USER_URL_KEY);
        addContractUrl = hostLocation + parametersBundle.getString(ADD_CONTRACT_URL_KEY);
        contractUrl = hostLocation + parametersBundle.getString(CONTRACT_URL_KEY);
        auditPagesSetupUrl = hostLocation + parametersBundle.getString(AUDIT_PAGES_URL_KEY);
        auditSiteSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SITE_URL_KEY);
        auditUploadSetupUrl = hostLocation + parametersBundle.getString(AUDIT_UPLOAD_URL_KEY);
        auditScenarioSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SCENARIO_URL_KEY);
        addUserContractUrl = hostLocation + parametersBundle.getString(ADD_USER_CONTRACT_URL_KEY);
        editUserContractUrl = hostLocation + parametersBundle.getString(EDIT_USER_CONTRACT_URL_KEY);

        if (driver == null) {
            FirefoxBinary ffBinary = new FirefoxBinary();
            if (xvfbDisplay != null) {
                Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + xvfbDisplay);
                ffBinary.setEnvironmentProperty("DISPLAY", xvfbDisplay);
            }
            driver = new FirefoxDriver(ffBinary, new FirefoxProfile());
        }
    }
 
开发者ID:Tanaguru,项目名称:Tanaguru,代码行数:48,代码来源:AbstractWebDriverTestClass.java


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