简体   繁体   English

如何使用 selenium Python 定期重新登录?

[英]How to periodically relogin with selenium Python?

The site i'am scraping shows an exception every almost 20 minutes 'the session is expired because of inactivity '我正在抓取的网站每近 20 分钟显示一次异常“session 由于不活动而过期”
Is there a way to fix that?有没有办法解决这个问题?

The simplest solution is to click on some element on the page or perform some action with Actions class, like hovering over some sensitive element or even refresh the page.最简单的解决方案是单击页面上的某些元素或使用Actions class 执行某些操作,例如将鼠标悬停在某些敏感元素上,甚至刷新页面。

There are multiple ways of refreshing a page in Selenium, I think the most used way of refreshing a webpage is with this command. Selenium中有多种刷新页面的方法,我认为刷新页面最常用的方法是使用此命令。

driver.navigate().refresh();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM