无论如何,该驱动程序可以记住logged in session
,因此它不会将我带回Login
页面(例如google-chrome
)?
这就是我现在正在做的事情
public static void main(String[] args) throws Exception {
driver = new ChromeDriver();
driver.get("http://localhost/interestingStuff); //I get redirected to login page
login(); //logins in to the page and submits(note I try to omit this part if possible).
doStuff();
driver.close(); //I want to be able to keep session next time I start this program.
}
答案 0 :(得分:6)
具有默认配置的Selenium为每个会话创建临时配置文件,并在下班后删除此临时文件。
因此,如果您想保存cookie(重新加入“登录会话”),您需要通过以下方式之一: