Calling browser.clearLocalStorage() results in error
See original GitHub issue[//]: # NOTE: This repository only maintains packages that are listed in the Readme. Please make sure that your issue is directly caused by one of these packages and if not file an issue in the correct 3rd party package repository.
Environment (please complete the following information):
- WebdriverIO version: 6.1.12
- Mode: WDIO Testrunner
- If WDIO Testrunner, running sync/async: sync
- Node.js version: 10.20.1
- NPM version: 6.14.4
- Browser name and version: Safari 12.1
- Platform name and version: iOS 12.1
- Additional wdio packages used (if applicable): β@wdio/appium-serviceβ: β^6.1.0β, β@wdio/cliβ: β^6.1.11β, β@wdio/jasmine-frameworkβ: β^6.1.8β, β@wdio/junit-reporterβ: β^6.1.9β, β@wdio/local-runnerβ: β^6.1.11β, β@wdio/spec-reporterβ: β^6.1.9β, β@wdio/syncβ: β^6.1.8β,
Config of WebdriverIO N/A
Describe the bug
Executing browser.clearLocalStorage()
in webview context results in an error:
ERROR webdriver: Request failed with status 500 due to unknown error: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
To Reproduce
Start test on iOS device, switch to webview context and try browser.clearLocalStorage()
[0-0] βΊ driver.switchContext('WEBVIEW_XXXX.X')
[0-0] 2020-06-26T07:42:49.266Z INFO webdriver: COMMAND switchContext("WEBVIEW_XXXX.X")
[0-0] 2020-06-26T07:42:49.269Z INFO webdriver: [POST] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/context
[0-0] 2020-06-26T07:42:49.269Z INFO webdriver: DATA { name: 'WEBVIEW_XXXX.X' }
null
[0-0] βΊ driver.clearLocalStorage();
Expected behavior Expected local storage to be empty and command not to raise an error
Log
[0-0] βΊ driver.getContext() # Check current context is webview
[0-0] 2020-06-26T07:42:30.816Z INFO webdriver: COMMAND getContext()
[0-0] 2020-06-26T07:42:30.817Z INFO webdriver: [GET] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/context
[0-0] 2020-06-26T07:42:30.820Z INFO webdriver: RESULT WEBVIEW_XXXX.X
'WEBVIEW_XXXX.X'
[0-0] βΊ driver.clearLocalStorage();
[0-0] 2020-06-26T07:42:53.539Z INFO webdriver: COMMAND clearLocalStorage()
[0-0] 2020-06-26T07:42:53.539Z INFO webdriver: [DELETE] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/local_storage
[0-0] 2020-06-26T07:42:53.554Z DEBUG webdriver: request failed due to response error: unknown error
[0-0] 2020-06-26T07:42:53.554Z INFO webdriver: Retrying 1/3
2020-06-26T07:42:53.554Z INFO webdriver: [DELETE] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/local_storage
[0-0] 2020-06-26T07:42:53.554Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
[0-0] 2020-06-26T07:42:53.568Z DEBUG webdriver: request failed due to response error: unknown error
[0-0] 2020-06-26T07:42:53.569Z INFO webdriver: Retrying 2/3
2020-06-26T07:42:53.569Z INFO webdriver: [DELETE] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/local_storage
[0-0] 2020-06-26T07:42:53.569Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
[0-0] 2020-06-26T07:42:53.584Z DEBUG webdriver: request failed due to response error: unknown error
[0-0] 2020-06-26T07:42:53.584Z INFO webdriver: Retrying 3/3
2020-06-26T07:42:53.585Z INFO webdriver: [DELETE] http://localhost:4723/session/ab4bbe39-4ec2-4e4e-b609-04da018b7e23/local_storage
[0-0] 2020-06-26T07:42:53.584Z WARN webdriver: Request failed with status 500 due to An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
[0-0] 2020-06-26T07:42:53.598Z DEBUG webdriver: request failed due to response error: unknown error
[0-0] 2020-06-26T07:42:53.599Z ERROR webdriver: Request failed with status 500 due to unknown error: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
Thrown:
/Users/user.name/Projects/ft-app/node_modules/@wdio/sync/build/wrapCommand.js:76
throw e;
^
unknown error: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 400 - undefined
at evalmachine.<anonymous>:1:8
at Script.runInContext (vm.js:133:20)
at Object.runInContext (vm.js:311:6)
at WDIORepl._runCmd (/Users/user.name/Projects/project/node_modules/@wdio/repl/build/index.js:54:34)
at /Users/user.name/Projects/user.name/node_modules/@wdio/repl/build/index.js:46:57
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How to clear local storage before running each test in ...
I am now using WebdriverIO and this is the approach that I was trying out (in the test file). afterEach(() => { browser.executeScript('window....
Read more >How to clear local storage in Google Chrome (and other ...
Here's how to clear the local storage in Microsoft Edge: Press Ctrl + Shift + Delete; Select Cookies and cached data, then click...
Read more >How to clear localStorage using selenium and webdriver
The answer Peter Masiar gave no longer works. This answer will result in the following exception: Traceback (most recent call last): File "",...
Read more >clearLocalStorage - Cypress Documentation
Clear data in localStorage for current domain and subdomain. Cypress automatically clears all local storage before each test to prevent state from being....
Read more >Storage clear() Method - W3Schools
The clear() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorrage object. Browser Support. Method. clear(),...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@raditotev
This looks like a 3rd-party issue with Appium not with WDIO. Which version of Appium are you using?
The workaround would be to inject a script with something like this
Thank you both π