等待使用webdriver删除cookie? [英] Waiting for deleting cookies with webdriver?

查看:186
本文介绍了等待使用webdriver删除cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于使用webdriver删除cookie的问题。
是否应该创建其他代码,以便在删除Cookie结束后等待,否则此功能将为我完成?

I have a question about deleting cookies using webdriver. Should I create additional code that will wait when deleting cookies is finished or this function will do it for me?

driver.Manage().Cookies.DeleteAllCookies();

在删除所有Cookie之前,我的考试不会进行下一步吗?

I meam test will not go to next steps until all cookies will be deleted?

推荐答案

在我的测试中, driver.manage()。deleteAllCookies()是不阻塞的。
所以我遇到问题,在测试中间删除了一些cookie。

In my tests, the driver.manage().deleteAllCookies() is non blocking. So i got issues that some cookies were deleted in the middle of the test.

因此,也许您想使用tearDown方法执行 deleteAllCookies(),或者您需要在通话后等待:

So maybe you want to do the deleteAllCookies() in a tearDown method, or you need to wait after the call:

driver.manage().deleteAllCookies();
try {
  Thread.sleep(5000);
} catch (InterruptedException e) {
  e.printStackTrace();
}

这篇关于等待使用webdriver删除cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆