win7下安裝chromedriver和selenium測試
阿新 • • 發佈:2019-01-09
win7安裝chromedriver
一.安裝指定版本的Chrome
如下要求
chromedriver與chrome的對應關係表
chromedriver版本 支援的Chrome版本
v2.29 v56-58
v2.28 v55-57
v2.27 v54-56
v2.26 v53-55
v2.25 v53-55
二.安裝chromedriver
三.測試程式碼
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
brower = webdriver.Chrome()
try:
brower.get('http://www.iqiyi.com')
widget_playcount = brower.find_element_by_id("widget-playcount")
print(widget_playcount.text)
print(brower.current_url)
finally :
brower.close()
OK完成