List of usage examples for org.openqa.selenium.firefox FirefoxBinary FirefoxBinary
public FirefoxBinary(File pathToFirefoxBinary)
From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java
License:Open Source License
/** * <p>browserEngineTest_16.</p> * * @throws java.io.IOException if any.//from w w w. j av a2s . c om * @throws java.lang.InterruptedException if any. */ public static void browserEngineTest_16() throws IOException, InterruptedException { FirefoxProfile profile = new FirefoxProfile( TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver")); WebDriver wdriver = new FirefoxDriver( new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")), profile); // WebDriver wdriver = new FirefoxDriver(); wdriver.get("http://www.cs.uga.edu/~neasbitt/"); wdriver.switchTo().activeElement(); Thread.sleep(10000); WebElement elem = wdriver.findElement(By.id("logo")); List<String> locator = JSUtils.getElementLocator(wdriver, elem); for (String s : locator) { System.out.println(s); } wdriver.close(); }
From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java
License:Open Source License
/** * <p>browserEngineTest_17.</p> * * @throws java.io.IOException if any./*from w w w . ja va 2 s . c o m*/ * @throws java.lang.InterruptedException if any. * @throws edu.uga.cs.clickminer.exception.ProxyErrorException if any. */ public static void browserEngineTest_17() throws IOException, InterruptedException, ProxyErrorException { FirefoxProfile profile = new FirefoxProfile( TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver")); WebDriver wdriver = new FirefoxDriver( new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")), profile, TestUtils.createProxyConfig()); ProxyClient pc = new ProxyClient("127.0.0.1", 8888); BrowserEngine bengine = new BrowserEngine(pc, wdriver, true, true); wdriver.get("file:///home/cjneasbi/workspace/clickminer-browser/resource/test/js_test.html"); wdriver.switchTo().activeElement(); Thread.sleep(5000); List<WebElement> elements = bengine.findJSClickableElements(); for (WebElement elem : elements) { System.out.println(elem.getAttribute("id")); } bengine.close(); }
From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java
License:Open Source License
/** * <p>browserEngineTest_18.</p> * * @throws java.io.IOException if any./*from w ww .j a va 2 s. c om*/ * @throws java.lang.InterruptedException if any. */ public static void browserEngineTest_18() throws IOException, InterruptedException { FirefoxProfile profile = new FirefoxProfile( TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver")); WebDriver wdriver = new FirefoxDriver( new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")), profile); // WebDriver wdriver = new FirefoxDriver(); wdriver.get("http://www.cs.uga.edu/~neasbitt/"); wdriver.switchTo().activeElement(); Thread.sleep(5000); WebElement elem = wdriver.findElement(By.id("profile")); Map<String, String> attrs = JSUtils.getElementAttributes(wdriver, elem); System.out.println(attrs); wdriver.close(); }
From source file:edu.uga.cs.clickminer.test.BrowserEngineTest.java
License:Open Source License
/** * <p>browserEngineTest_19.</p> * * @throws edu.uga.cs.clickminer.exception.ProxyErrorException if any. * @throws java.lang.InterruptedException if any. *//*from www. j a va2 s .c o m*/ public static void browserEngineTest_19() throws ProxyErrorException, InterruptedException { FirefoxProfile profile = new FirefoxProfile( TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver")); WebDriver wdriver = new FirefoxDriver( new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-17.0/firefox-bin")), profile, TestUtils.createProxyConfig()); for (int i = 0; i < 10; i++) { //wdriver.get("http://choices.truste.com/get?name=admarker-full-tr.png"); wdriver.get("http://blah.blah.com"); Thread.sleep(5000); } wdriver.quit(); }
From source file:edu.uga.cs.clickminer.test.ProxyClientTest.java
License:Open Source License
/** * <p>proxyClientTest_7.</p> * * @throws java.lang.Exception if any.//from w w w .java2s.c om */ public static void proxyClientTest_7() throws Exception { FirefoxProfile profile = new FirefoxProfile( TestUtils.getWebdriverProfile("/home/cjneasbi/.mozilla/firefox", "webdriver")); WebDriver wdriver = new FirefoxDriver( new FirefoxBinary(new File("/home/cjneasbi/Desktop/old_firefox/firefox-14.0.1/firefox-bin")), profile, TestUtils.createProxyConfig()); ProxyClient pc = new ProxyClient("127.0.0.1", 8888); pc.setModeNoContent("http://www.newegg.com"); if (pc.getMode() == ProxyMode.NOCONTENT) { System.out.println("Pass"); } else { System.out.println("Fail"); } wdriver.get("http://www.yahoo.com"); Thread.sleep(2000); if (pc.getMode() == ProxyMode.NOCONTENT) { System.out.println("Pass"); } else { System.out.println("Fail"); } wdriver.get("http://www.newegg.com"); Thread.sleep(2000); if (pc.getMode() == ProxyMode.CONTENT) { System.out.println("Pass"); } else { System.out.println("Fail"); } wdriver.close(); }
From source file:evaluation.ExperimentRunner.java
License:Apache License
private void setup() throws Exception { System.out.println("xxx1"); DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); LoggingPreferences loggingPreferences = new LoggingPreferences(); System.out.println("xxx2"); loggingPreferences.enable(LogType.BROWSER, Level.ALL); desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences); FirefoxBinary binary = new FirefoxBinary(new File(firefoxBinary)); FirefoxProfile profile = new FirefoxProfile(); System.out.println("xxx3"); System.setProperty("webdriver.firefox.logfile", firefoxLogFile); profile.setPreference("webdriver.log.file", javascriptLogFile); profile.setPreference("dom.max_script_run_time", maxWaitTime); // Do not divert any links (browser.link.open_newwindow will have no // effect)./*www.j a va 2 s .co m*/ // http://kb.mozillazine.org/Browser.link.open_newwindow.restriction profile.setPreference("dom.popup_allowed_events", ""); profile.setPreference("dom.popup_maximum", 0); profile.addExtension(new File(jalangiFFxpi)); System.out.println("xxx4"); driver = new FirefoxDriver(binary, profile, desiredCapabilities); System.out.println("xxx5"); driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS); System.out.println("xxx6"); }
From source file:evaluation.JalangiFirefoxRunner.java
License:Apache License
private void setup() throws Exception { DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); LoggingPreferences loggingPreferences = new LoggingPreferences(); loggingPreferences.enable(LogType.BROWSER, Level.ALL); desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences); FirefoxBinary binary = new FirefoxBinary(new File(firefoxBinary)); FirefoxProfile profile = new FirefoxProfile(); System.setProperty("webdriver.firefox.logfile", firefoxLogFile); profile.setPreference("webdriver.log.file", javascriptLogFile); profile.setPreference("dom.max_script_run_time", maxWaitTime); // Do not divert any links (browser.link.open_newwindow will have no effect). // http://kb.mozillazine.org/Browser.link.open_newwindow.restriction profile.setPreference("dom.popup_allowed_events", ""); profile.setPreference("dom.popup_maximum", 0); driver = new FirefoxDriver(binary, profile, desiredCapabilities); driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS); }
From source file:evaluation.OctaneExperimentRunner.java
License:Apache License
private void run(String benchmark) throws Exception { DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); LoggingPreferences loggingPreferences = new LoggingPreferences(); loggingPreferences.enable(LogType.BROWSER, Level.ALL); desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences); FirefoxBinary binary = new FirefoxBinary(new File(firefoxBinary)); FirefoxProfile profile = new FirefoxProfile(); System.setProperty("webdriver.firefox.logfile", firefoxLogFile); profile.setPreference("webdriver.log.file", javascriptLogFile); profile.setPreference("dom.max_script_run_time", maxWaitTime); profile.setPreference("extensions.sdk.console.logLevel", "info"); profile.addExtension(new File(jalangiFFxpi)); driver = new FirefoxDriver(binary, profile, desiredCapabilities); driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS); testBenchmark(benchmark);/*from w ww.j a v a2 s . c o m*/ driver.quit(); System.out.println("Done :-)"); }
From source file:gov.nih.nci.firebird.commons.selenium2.test.WebDriverModule.java
License:Open Source License
@Provides @Singleton// w ww . jav a 2 s .c o m @Named("selenium.firefox.driver") public WebDriver provideFirefoxDriver(@Named("selenium.firefox.profile.location") String profileLocation, @Named("selenium.firefox.binary.location") String binaryLocation) { FirefoxProfile profile = null; FirefoxBinary binary = null; try { File profileDir = new File(profileLocation); profile = new FirefoxProfile(profileDir); } catch (UnableToCreateProfileException e) { } File binaryDir = new File(binaryLocation); if (binaryDir.exists()) { binary = new FirefoxBinary(binaryDir); } WebDriver driver = new FirefoxDriver(binary, profile); closeDriverOnShutdown(driver); return driver; }
From source file:org.asqatasun.websnapshot.service.SnapshotCreatorImpl.java
License:Open Source License
/** * * @return//from w w w . j a v a 2s .co m */ private RemoteWebDriver getWebDriver(int windowWidth, int windowHeight, String webDriver) { RemoteWebDriver driver; if (webDriver.equals(FIREFOX_BROWSER_NAME)) { driver = new FirefoxDriver(new FirefoxBinary(new File(firefoxBinaryPath)), new FirefoxProfile()); } else { DesiredCapabilities caps = DesiredCapabilities.phantomjs(); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJsBinaryPath); driver = new PhantomJSDriver(caps); } driver.manage().window().setSize(new Dimension(windowWidth, windowHeight)); return driver; }