
python
import os
import sys
from selenium import webdriver
替换为你的ChromeDriver路径
chrome_driver_path = 'path/to/your/chromedriver'
打开Chrome浏览器
driver = webdriver.Chrome(chrome_driver_path)
遍历当前目录下的所有文件和文件夹
for root, dirs, files in os.walk('.'):
for file in files:
if file.endswith('.') or file.endswith('.htm'):
打开对应的网页
driver.get(os.path.join(root, file))
等待页面加载完成
driver.implicitly_wait(10)
关闭标签页
driver.close()
关闭Chrome浏览器
driver.quit()
请确保将`chrome_driver_path`变量设置为你的ChromeDriver的实际路径。运行此脚本后,它将遍历当前目录下的所有HTML文件和文件夹,并使用Selenium库打开它们,然后关闭对应的标签页。



