List of usage examples for org.openqa.selenium WebDriver quit
void quit();
From source file:zz.pseas.ghost.login.weibo.WeiboLogin.java
License:Apache License
public static void main(String[] args) { WebDriver driver = BrowserFactory.getIE(); driver.get("http://weibo.com/"); Set<Cookie> cookies = driver.manage().getCookies(); BasicCookieStore cookieStore = new BasicCookieStore(); for (Cookie c : cookies) { BasicClientCookie c1 = new BasicClientCookie(c.getName(), c.getValue()); c1.setDomain(c.getDomain() == null ? "weibo" : c.getDomain()); c1.setPath(c.getPath());//from w w w . j a va2 s. c om Date d = c.getExpiry(); if (d != null) { c1.setExpiryDate(d); } cookieStore.addCookie(c1); } driver.quit(); GhostClient client = new GhostClient("utf-8", cookieStore); String url = "http://weibo.com/p/10080813dc27e2acb1441006674c8aa2ef07d4/followlist?page=1#Pl_Core_F4RightUserList__38"; //HttpGet get = new HttpGet(url); String s = client.get(url); System.out.println(s); String next = StringUtil.regex(s, "(?<=replace\\(\").*?(?=\")"); String html = client.get(next); System.out.println(html); }