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


Java ProfilesIni类代码示例

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


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

示例1: navAdminFirefox17

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
/**
	 * @author andre.tschirch
	 * 
	 * Example test method for using specific Firefox version e.g. v17. 
	 *   
	 * Test method for running a successful login and the right presentation of
	 * the activity state of the admin navigation link, which must be active,
	 * for browser Firefox.
	 */
//	@Test
	public void navAdminFirefox17() {
		ProfilesIni profile = new ProfilesIni();
		FirefoxProfile firefoxProfile = profile.getProfile("firefox17");
		WebDriver driver = new FirefoxDriver(new FirefoxBinary(new File("D:/schatzsuche/firefox17/firefox.exe")), firefoxProfile);
		TestBrowser browser = Helpers.testBrowser(driver, 3333);
		
		TestServer server = Helpers.testServer(3333, Helpers.fakeApplication());
		TestServer startedServer = null;
		try {
			server.start();
			startedServer = server;
			new NavAdminCallbackComposite().invoke(browser);
		} catch(Throwable t) {
            throw new RuntimeException(t);
        } finally {
            if(browser != null) {
                browser.quit();
            }
            if(startedServer != null) {
                startedServer.stop();
            }
        }
	}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:34,代码来源:CommonBrowserNavigationTest.java

示例2: FirefoxFeatureProfile

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
/**
 * Instantiates a new profile creator.
 *
 * @param profileName
 *            the profile name
 */

public FirefoxFeatureProfile(   String profileName) {
	super(); 
	if (StringUtils.isEmpty(profileName)) {
		throw new IllegalArgumentException();
	}
	this.profileName = profileName;

	ProfilesIni profileIni = new ProfilesIni();
	FirefoxProfile tmpProfile = profileIni.getProfile(profileName);
	if (null == tmpProfile) {
		throw new IllegalArgumentException(
				"Could not find the browser profile.");
	} else {
		this.profile = tmpProfile;
	}

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

示例3: createRobotizedWebDriverFactory

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
public static LocalRobotizedBrowserFactory createRobotizedWebDriverFactory(String browser) {
    if (BrowserType.FIREFOX.equalsIgnoreCase(browser)) {
        FirefoxProfile firefoxProfile = null;
        String firefoxProfileProperty = System.getProperty("webdriver.firefox.profile");
        if (firefoxProfileProperty == null) {
            ProfilesIni allProfiles = new ProfilesIni();
            // Use the default profile to make extensions available,
            // and especially to ease debugging with Firebug
            firefoxProfile = allProfiles.getProfile("default");
        }
        return new LocalFirefox(firefoxProfile);
    } else if (BrowserType.SAFARI.equalsIgnoreCase(browser)) {
        return new LocalSafari();
    } else if (BrowserType.CHROME.equalsIgnoreCase(browser)) {
        return new LocalBrowser<ChromeDriver>(ChromeDriver.class);
    } else if ("chrome-debug".equalsIgnoreCase(browser)) {
        return new LocalDebuggableChrome();
    } else if (BrowserType.IE.equalsIgnoreCase(browser)) {
        return new LocalBrowser<InternetExplorerDriver>(InternetExplorerDriver.class);
    } else {
        throw new RuntimeException("Unknown browser value: " + browser);
    }

}
 
开发者ID:attester,项目名称:selenium-java-robot,代码行数:25,代码来源:LocalRobotizedBrowserFactory.java

示例4: start

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
@Override
public void start() throws CandybeanException {
	String profileName = candybean.config.getValue("browser.firefox.profile", "default");
	File ffBinaryPath = new File(candybean.config.getPathValue("browser.firefox.binary"));
	if(!ffBinaryPath.exists()){
		String error = "Unable to find firefox browser driver from the specified location in the configuration file! \n"
				+ "Please add a configuration to the candybean config file for key \"browser.firefox.binary\" that"
				+ "indicates the location of the binary.";
		logger.severe(error);
		throw new CandybeanException(error);
	} else {
		FirefoxProfile ffProfile = (new ProfilesIni()).getProfile(profileName);
		FirefoxBinary ffBinary = new FirefoxBinary(ffBinaryPath);
		logger.info("Instantiating Firefox with profile name: "
				+ profileName + " and binary path: " + ffBinaryPath);
		super.wd = new FirefoxDriver(ffBinary, ffProfile);
		super.start(); // requires wd to be instantiated first
	}
}
 
开发者ID:sugarcrm,项目名称:candybean,代码行数:20,代码来源:FirefoxInterface.java

示例5: setUp

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
@Before
public void setUp() throws MalformedURLException {
    FirefoxProfile profile = new FirefoxProfile();
    ProfilesIni profilesIni = new ProfilesIni();
    profile = profilesIni.getProfile("default");
    // The following 3 settings disable the 'Firefox automatically sends some data to Mozilla...'
    profile.setPreference("datareporting.healthreport.uploadEnabled", false);
    profile.setPreference("datareporting.healthreport.service.enabled", false);
    profile.setPreference("datareporting.healthreport.service.firstRun", false);
    webDriver = new FirefoxDriver(profile); //TODO headless? phantom js?
    webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
 
开发者ID:Glamdring,项目名称:scientific-publishing,代码行数:13,代码来源:BaseTest.java

示例6: getFirefoxDriverWithUserAgent

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
/**
 * Creates a FirefoxDriver that has the supplied user agent.
 * 
 * @param userAgent
 *            the user agent
 * @return a new FirefoxDriver instance containing the specified user agent
 *         settings
 */

public static WebDriver getFirefoxDriverWithUserAgent(final String userAgent) {
	ProfilesIni allProfiles = new ProfilesIni();
	FirefoxProfile profile = allProfiles.getProfile("default");
	profile.setPreference("general.useragent.override", userAgent);
	profile.setAcceptUntrustedCertificates(true);
	profile.setAssumeUntrustedCertificateIssuer(true);
	WebDriver driver = new FirefoxDriver(profile);
	return driver;

}
 
开发者ID:ludovicianul,项目名称:selenium-on-steroids,代码行数:20,代码来源:WebDriverHelper.java

示例7: main

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	
	
	WebDriver driver = new FirefoxDriver();
	driver.get("https://www.beyondtherack.com");
	driver.manage().window().maximize();
	
       driver.findElement(By.xpath(".//*[@id='fb-login']")).click();
       String driverState = driver.getWindowHandle();
       for (String handle : driver.getWindowHandles()) {

                 driver.switchTo().window(handle);
               }

       driver.findElement(By.cssSelector("#email")).sendKeys("[email protected]");

       driver.findElement(By.cssSelector("#pass")).sendKeys("happiest");

       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

	
	 //Class ProfilesIni details
	 ProfilesIni allProfiles = new ProfilesIni();
	 // Use FirefoxProfile Constructor
	 FirefoxProfile myProfile = allProfiles.getProfile("CertificateIssue"); 
//	 myProfile.setAcceptUntrustedCertificates(true);
	 myProfile.setAssumeUntrustedCertificateIssuer(true);
	 WebDriver Driver = new FirefoxDriver(myProfile); 
	 Driver.get("http://abodeqa.wordpress.com");
}
 
开发者ID:SeleniumAutomation,项目名称:SeleniumDemos,代码行数:34,代码来源:CertificateErrorHandling.java

示例8: createWebDriver

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的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: addSpecificBrowserSettings

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
/**
 * This method adds browser specific capabilities like FirefoxProfile and
 * ChromeOptions.
 * 
 * @param capabilities
 *            specific capabilities
 * @param builder
 *            the builder object containing the properties
 */
private static void addSpecificBrowserSettings(
		final DesiredCapabilities capabilities, final Builder builder) {
	if (capabilities.getBrowserName().equalsIgnoreCase(
			Constants.Browsers.FIREFOX)) {
		LOG.info("Browser is Firefox. Getting local profile");

		FirefoxProfile profile = null;

		if (builder.profileLocation != null
				&& !"".equalsIgnoreCase(builder.profileLocation)) {
			profile = new FirefoxProfile(new File(builder.profileLocation));
			LOG.info("Firefox profile: " + builder.profileLocation);
		} else {
			LOG.info("Loading Firefox default sprofile");
			ProfilesIni allProfiles = new ProfilesIni();
			allProfiles.getProfile("default");
		}

		capabilities.setCapability(FirefoxDriver.PROFILE, profile);

		if (builder.userAgent != null) {
			profile.setPreference("general.useragent.override",
					builder.userAgent);
		}

	} else if (capabilities.getBrowserName().equalsIgnoreCase(
			Constants.Browsers.CHROME)) {
		ChromeOptions options = new ChromeOptions();
		if (builder.userAgent != null) {
			options.addArguments("user-agent=" + builder.userAgent);
		}
		capabilities.setCapability(ChromeOptions.CAPABILITY, options);
	} else if (capabilities.getBrowserName().equalsIgnoreCase(
			Constants.Browsers.IE)) {
		capabilities
				.setCapability(
						InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
						builder.flakinessForIe);
	}
	LOG.info("Finished adding specific browser settings");
}
 
开发者ID:ludovicianul,项目名称:selenium-on-steroids,代码行数:51,代码来源:WebDriverHelper.java

示例10: main3

import org.openqa.selenium.firefox.internal.ProfilesIni; //导入依赖的package包/类
public static void main3(String[] args) throws Exception {

			FirefoxProfile fp = new FirefoxProfile();
			ProfilesIni allProfiles = new ProfilesIni();
			fp = allProfiles.getProfile("default");
			WebDriver driver = new FirefoxDriver(fp);
			driver.get("http://www.baidu.com/");

			
		}
 
开发者ID:xiaomin0322,项目名称:alimama,代码行数:11,代码来源:Test.java


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