selenium关闭页面和浏览器
作者:
徒手說梦话 | 来源:发表于
2019-02-16 12:02 被阅读0次from selenium import webdriver
import time
# chromedriver的绝对路径
driver_path = r'D:\python\geckodriver-v0.23.0-win64\geckodriver.exe'
# 初始化一个driver,并且指定chchromedriver的路径
driver = webdriver.Firefox(executable_path=driver_path)
# 请求网页
driver.get("https://www.baidu.com/")
# 通过page_source获取网页源代码
# print(driver.page_source)
time.sleep(5)
driver.close() #关闭当前页面
# driver.quit() # 退出整个浏览器
本文标题:selenium关闭页面和浏览器
本文链接:https://www.haomeiwen.com/subject/kfubeqtx.html
网友评论