下载jar包:
selenium-server-standalone-2.44.0.jar
运行jar包:
java -jar selenium-server-standalone-2.44.0.jar
运行后默认开启4444端口
python请求代码:
# -*- coding: utf-8 -*- from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import selenium.webdriver.support.ui as ui
import os,time, urllib2 def search_engine(query_word):
#browser = webdriver.Firefox()
#wait = ui.WebDriverWait(browser,10) # 设定最长等待加载时间为10秒 browser = webdriver.Remote('http://localhost:4444/wd/hub', desired_capabilities=DesiredCapabilities.HTMLUNIT)
browser.get("http://gsxt.hnaic.gov.cn/notice/home") #打开网址
完毕