腳本執行期間網站會話過期。我有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