Java Code Examples for com.gargoylesoftware.htmlunit.BrowserVersion.FIREFOX_3_6

The following are Jave code examples for showing how to use FIREFOX_3_6 of the com.gargoylesoftware.htmlunit.BrowserVersion class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: webmonitor   File: Configuration.java   View Source Code Vote up 6 votes
@SuppressWarnings("deprecation")
public BrowserVersion getBrowserEnum() {
       if (browserName.equals("Mozilla Firefox 3.6")) {
           return BrowserVersion.FIREFOX_3_6;
       }
       else if (browserName.equals("Mozilla Firefox 10")) {
           return BrowserVersion.FIREFOX_10;
       }
       else if (browserName.equals("Mozilla Firefox 17")) {
           return BrowserVersion.FIREFOX_17;
       }
       else if (browserName.equals("IE 6")) {
           return BrowserVersion.INTERNET_EXPLORER_6;
       } else if (browserName.equals("IE 7")) {
           return BrowserVersion.INTERNET_EXPLORER_7;
       } else if (browserName.equals("IE 8")) {
           return BrowserVersion.INTERNET_EXPLORER_8;
       }
       else if (browserName.equals("IE 9")) {
           return BrowserVersion.INTERNET_EXPLORER_9;
       }
       else if (browserName.equals("IE 10")) {
           return BrowserVersion.INTERNET_EXPLORER_10;
       }        
       return BrowserVersion.getDefault();
   }
 
Example 2
Project: RoMessenger   File: LoginManager.java   View Source Code Vote up 6 votes
public static void removeUser(String user) {
	Link.manager.closeAllWindows();
	Link.manager = new WebClient(BrowserVersion.FIREFOX_3_6);
	Link.manager.setCssEnabled(false);
	Link.manager.setJavaScriptEnabled(true);
	Link.manager.setRedirectEnabled(true);
	Link.manager.setThrowExceptionOnFailingStatusCode(false);
	Link.manager.setThrowExceptionOnScriptError(false);
	Link.manager.setPrintContentOnFailingStatusCode(false);

	loggedInToDesktop = false;
	loggedInToMobile = false;

	userLoggingIn = "";
	userPass = "";

	currentUser = "";

	try {
		Link.mobileManager.getPage("http://m.roblox.com/Account/LogOff");
	} catch (Exception e) {
		e.printStackTrace();
	}

	users.remove(user);
}
 
Example 3
Project: RoMessenger   File: LoginManager.java   View Source Code Vote up 6 votes
public static void changeUser(String user) {
	if (users.containsKey(user)) {
		userLoggingIn = user;
		userPass = users.get(user);

		Link.manager.closeAllWindows();
		Link.manager = new WebClient(BrowserVersion.FIREFOX_3_6);
		Link.manager.setCssEnabled(false);
		Link.manager.setJavaScriptEnabled(true);
		Link.manager.setRedirectEnabled(true);
		Link.manager.setThrowExceptionOnFailingStatusCode(false);
		Link.manager.setThrowExceptionOnScriptError(false);
		Link.manager.setPrintContentOnFailingStatusCode(false);
		loggedInToDesktop = false;
		loggedInToMobile = false;

		loginToRobloxMobile(user, users.get(user));
	}
	System.gc();
}
 
Example 4
Project: RoMessenger   File: LoginManager.java   View Source Code Vote up 5 votes
public static void addUser(String user, String pass) {
	if (!users.containsKey(user)) {
		userLoggingIn = user;
		userPass = pass;

		Link.manager.closeAllWindows();
		Link.manager = new WebClient(BrowserVersion.FIREFOX_3_6);

		loggedInToDesktop = false;
		loggedInToMobile = false;

		loginToRobloxMobile(user, pass);
	}
}
 
Example 5
Project: hackernews-miner   File: HackernewsMiner.java   View Source Code Vote up 5 votes
public HackernewsMiner() {
    logger = LoggerFactory.getLogger(HackernewsMiner.class);
    wc = new WebClient(BrowserVersion.FIREFOX_3_6);
    wc.setThrowExceptionOnFailingStatusCode(false);
    wc.setJavaScriptEnabled(false);
    wc.setCssEnabled(false);
    props = HackernewsMinerProperties.props();
    rankMatch = Pattern.compile("is the (#([0-9]+) )?most popular language on GitHub");
    numReposMatch = Pattern.compile("Repositories \\(([0-9]+)\\)");
    httpDelay = Integer.parseInt(props.getProperty(PropNames.HTTP_DELAY, Defaults.HTTP_DELAY));
}
 
Example 6
Project: kansalaisaloite   File: WebTestBase.java   View Source Code Vote up 4 votes
@Before
    public void init() {
        if (urls == null) {
            Urls.initUrls(env.getRequiredProperty(PropertyNames.baseURL), env.getProperty(PropertyNames.superSearchBaseUrl));
            urls = Urls.FI;
        }

        String driverType = env.getProperty("test.web-driver", "hu");
        System.out.println("*** driverType = " + driverType);
        if ("ie".equals(driverType)) {
            driver = new InternetExplorerDriver();
            driver.get(urls.frontpage());
            driver.navigate().to("javascript:document.getElementById('overridelink').click()"); // to skip security certificate problem page
        }
        else if ("ff".equals(driverType)) {
            driver = new FirefoxDriver();
        }
//        else if ("safari".equals(driverType)) {
//            driver = new SafariDriver();
//        }
        else {
        	HtmlUnitDriver htmlUnitDriver =	new HtmlUnitDriver(BrowserVersion.FIREFOX_3_6);
            htmlUnitDriver.setJavascriptEnabled(true);
        	driver = htmlUnitDriver;
        }

        driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); // default is 0!!!
        driver.manage().timeouts().setScriptTimeout(50, TimeUnit.SECONDS); // default is 0!!!
        driver.manage().window().setSize(new Dimension(1024, 768));
        //driver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS); // default is 0!!!
        
        if (urls == null) {
            Urls.initUrls("https://localhost:" + PORT, env.getProperty(PropertyNames.superSearchBaseUrl));
            urls = Urls.FI;
        }
        testHelper.dbCleanup();
        Long userIdOM = testHelper.createOMTestUserWithHash(OM_USER_SSN);
        System.out.println("*** OM user " + OM_USER_SSN + " created with id " + userIdOM);
        Long userIdVRK = testHelper.createVRKTestUserWithHash(VRK_USER_SSN);
        System.out.println("*** VRK user " + VRK_USER_SSN + " created with id " + userIdVRK);
    }
 
Example 7
Project: haddock   File: Main.java   View Source Code Vote up 4 votes
/**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException {
        if (args.length > 0 && args[0].equals("LOGIN")) {
            WebClient wc = new WebClient(BrowserVersion.FIREFOX_3_6);
            wc.setThrowExceptionOnScriptError(false);
            try {
                URL url = new URL(
                        "http://www.racingpost.com/horses2/cards/home.sd");
                HtmlPage hp = wc.getPage(url);
                HtmlAnchor a = hp.getAnchorByText("Racing Post Log in or Register");
                LOG.debug(a.click());
//                HtmlAnchor ha = hp.getAnchorByText("Racing Post Log in or Register");
//                HtmlPage loginPage = ha.click();
//                LOG.debug(loginPage.toString());
//                for (HtmlForm f : loginPage.getForms()) {
//                    LOG.debug(f.getNameAttribute());
//                }
            }
            catch (Exception ioe) {
                LOG.error(ioe.getMessage(), ioe);
                LOG.error("There was an error!");
            }
        }
        else {
            try {
                URL startPage = new URL(
                        "http://www.racingpost.com/horses2/cards/home.sd");
                WebPageDownloader wpd = new WebPageDownloader();
                WebPage wp = wpd.download(startPage);
                LOG.debug("Downloaded");
                MainPageProcessor mpp = new MainPageProcessor();
                LOG.debug("Creater Race Card Processor");
                ArrayList<MainPageProcessor.Result> mainPageResults =
                        mpp.process(wp);
                RaceCardProcessor rcp = new RaceCardProcessor();
                for (int i = 0; i < mainPageResults.size(); i++) {
                    MainPageProcessor.Result mpr = mainPageResults.get(i);
                    WebPage page = wpd.download(mpr.url);
                    rcp.process(mpr.race, mpr.date, page);
                }
                System.exit(0);
            }
            catch (MalformedURLException mue) {}
        }
    }
 
Example 8
Project: delicious   File: WebClientUtils.java   View Source Code Vote up 4 votes
public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException {
	WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6);
	HtmlPage page = webClient.getPage("http://detail.tmall.com/item.htm?id=12923356887");
	System.out.println(page.asXml());
}