环境:
win10 x64
python 3.6.5
selenium-3.141.0
chromedriver_win32_for_chrom85
Chrome Version 85.0.4183.121 (Official Build) (32-bit)
id,classname请根据实际情况获取自己的
import time, sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def main(argv):
url = 'http://www.xxxxxxxx.com/'
# 驱动路径,这里根据自己情况更改
chrome_path = r'E:\Software\chromedriver.exe'
# 让浏览器不显示自动化测试
chrome_options = Options()
# chrome_options.add_argument('--headless')
driver = webdriver.Chrome(executable_path=chrome_path, chrome_options=chrome_options)
driver.get(url)
# 遮罩层处理
shadow_mask= driver.find_elements_by_class_name('close')
if len(shadow_mask) > 0:
print("有遮罩层,长度为:"+str(l