import urllib2 from selenium import webdriver chrome_options = webdriver.ChromeOptions() # 使用headless无界面浏览器模式 chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') driver= webdriver.Chrome(chrome_options=chrome_options,executable_path='C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe') mainUrl = "https://www.taobao.com/" driver.get(mainUrl) print browser.page_source browser.quit()
转载于:https://my.oschina.net/u/3554714/blog/1632654