我用selenium操作网页自动下载时,操作两三次后,总是提示会话过期,间隔30秒左右下载一次,这个网站会话过期时间大概是3分钟,我怀疑是被检测到自动工具导致,但是手工操作也是这样,但是只查询,不下载,会话就一直不会过期,请问有什么好的解决办法吗?改设置的隐藏参数都设置了,包括执行stealth.min.js,换火狐浏览器也是这样
```python
option = webdriver.ChromeOptions()
option.add_experimental_option('excludeSwitches', ['enable-automation'])
option.add_experimental_option('useAutomationExtension', False)
#option.add_argument("--headless")
option.add_argument('window-size=1920x1080')
option.add_argument('--start-maximized')
option.add_argument('--disable-gpu')
option.add_argument('blink-settings=imagesEnabled=false')
option.page_load_strategy = 'none' #页面加载策略:normal<eager<none
prefs = {
#'profile.managed_default_content_settings.images': 2, #禁用图片
'download.prompt_for_download': False,
'download.default_directory': self.save_path
}
option.add_experimental_option('prefs',prefs)
browser = webdriver.Chrome(options=option)
browser.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument', {'source': 'Object.defineProperty(navigator, "webdriver", {get: () => undefined})' })
wait = WebDriverWait(browser,10)
with open('stealth.min.js','r') as f:
stealth_min = f.read()
browser.execute_cdp_cmd('Page.addScriptToEvaluateOnNewDocument', {'source': stealth_min})
```