報錯如下:
Message: chrome not reachable
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.18363 x86_64)
代碼如下:
def startBrowser(name):
try:
if name == "sogou":
# 給Chrome一個二進制
options = webdriver.ChromeOptions() # 啟動引數
options.binary_location = SogouBrowser_location
chrome_driver_binary = SogouBrowser_path
print("start browser name :sogou")
driver = webdriver.Chrome(executable_path=chrome_driver_binary, options=options)
return driver
else:
print("Not found this browser,You can use 'firefox', 'chrome', 'ie' or 'phantomjs'")
except Exception as msg:
print("啟動瀏覽器出現例外:%s" % str(msg))
@threads(5)
def run_case(name):
driver = startBrowser(name)
driver.get(open_url)
time.sleep(3)
print(driver.title)
driver.quit()
if __name__ == "__main__":
names = ["sogou"]
for i in names:
run_case(i)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/60761.html
標籤:軟件測試
上一篇:python一個Excel表拆分成多個excel表報錯,求大神解答
下一篇:python電梯攝像頭監控報警
