脚本执行期间网站会话过期。我有4个有15-16个测试方法的类。而我使用testing.xml作为套件执行所有操作。脚本执行期间浏览器会话过期
方案:用户登录后,执行搜索
我使用以下条件
if(check user is already login)
{
if(check user is on homepage URL)
{
// if user is already on homepage then perform search
}
else
{
//here my code is first navigate the page to homepage and then perform search.
But the session get destroy once it navigate to home page here and the test get failed as
}
}
else
{
// not login then first do login and then perform search
}
所以我的问题是:
- 这是我的网站的问题或问题的webdriver?
- 为什么会话在页面导航中注销?我试过
driver.get()
和driver.navigate().to()
但没有成功。
如果遇到这样的问题,有人能给我提示吗?
这就是你的Web服务可能会如何维护会话。 – nullpointer
您需要检查会话中断的原因,这可能是您的网站问题,也可能是因为某种原因设计的。因此,首先自己想出 –
您还没有提供[mcve],我们可以在此重新制作问题。 – JeffC