appium-带有Appium的Android和iOS应用中的sso -cookies
我正在测试的应用程序使用基于网站的登录名。因此,一旦单击本机应用程序中的登录按钮,网络浏览量即可打开您可以输入凭据的位置。完成后,设置了一个单符号cookie,WebView关闭,本机应用程序将打开。
由于SSO结束,重置甚至重新安装应用程序都不会将用户列入。但是,为了使自动测试独立于彼此,我想在每个测试运行开始时始终登录用户。
我知道您可以使用硒/appium删除cookie,https://appium.io/docs/en/commands/web/storage/delete-allete-all-cookies/“ rel =“ nofollow noreforler”> https: //appium.io/docs/en/commands/web/storage/delete-all-cookies/ ,但这显然仅在WebView上下文中起作用。
是否有其他方法可以在Android和iOS中删除SSO cookie,并重置应用程序?
The app I am testing uses a website-based login. So as soon as you click on the login button in the native app a webview opens up where you can enter your credentials. Once done, a single-sign-on cookie is set, the webview closes and the native app opens back up.
Because of the SSO closing, resetting or even reinstalling the app does not log the user out. However, in order to make the automated tests independent of each other I want to have the user always logged out at the beginning of each test run.
I know you can delete cookies with Selenium/Appium with https://appium.io/docs/en/commands/web/storage/delete-all-cookies/, but this apparently only works when in a webview context.
Is there any other way to delete SSO cookies in Android and iOS and reset app the state?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能会尝试,不确定在您的情况下它是否有效:
(1)检查
driver.getContexThandles()
set inctainswebview_chrome
输入,如果有的话,您可以运行driver.context(“ WebView_chrome”)
然后 driver.manage()。deleteallcookies()将完成工作。(2)如果
WebView_Chrome
不存在,则可以尝试运行getDriver()。activateapp(“ com.android.chrome”)
,然后是上述指令(1)。You might try, not sure if it will work in your case:
(1) check if
driver.getContextHandles()
set containsWEBVIEW_chrome
entry and if it does, you can rundriver.context("WEBVIEW_chrome")
and thendriver.manage().deleteAllCookies()
will do the job.(2) if
WEBVIEW_chrome
is not there, you might try runninggetDriver().activateApp("com.android.chrome")
and then the above instruction (1).