超灬超  
import requests
import selenium
import wheel
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FOptions
from selenium.webdriver.chrome.options import Options as COptions

# driver = webdriver.Chrome(executable_path="D:\PDF\py包\chromedriver_win32\chromedriver.exe")
# driver1 = webdriver.Firefox(executable_path="D:\PDF\py包\geckodriver_win64\geckodriver.exe")

# Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
# 分手了  可以采用浏览器无头模式   红字是我容易忘记的地方  会导致报错   driver去官网下载即可
# browser = webdriver.PhantomJS(executable_path="D:\PDF\py包\phantomjs\phantomjs.exe")
# browser.get("www.baidu.com")
"""
无头模式
"""
options = COptions()
options.add_argument('-headless')
driver = webdriver.Chrome(executable_path="D:\PDF\py包\chromedriver_win32\chromedriver.exe",
                          chrome_options=options)
driver.get("http://www.sina.com")
print(driver.current_url)

  

posted on 2018-07-13 16:00  超灬超  阅读(1388)  评论(0编辑  收藏  举报