基於騰訊 x5 的引擎開發的混合 app,appim 切換 webview 時報錯。哪位大佬幫忙看看,有償解決。謝謝~
在基於 x5 開發的混合應用中,appium 切換 webview 報錯。
啟動配置如下:
實現程式碼:
報錯日誌
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/switch_to.py:30: in context
self._driver.execute(MobileCommand.SWITCH_TO_CONTEXT, {'name': context_name})
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/errorhandler.py:29: in check_response
raise wde
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/appium/webdriver/errorhandler.py:24: in check_response
super(MobileErrorHandler, self).check_response(response)
self =
response = {'status': 500, 'value': '{"value":{"error":"unknown error","message":"An unknown server-side error occurred while pro...um.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)"}}'}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value['value']
status = value.get('error', None)
if status is None:
status = value["status"]
message = value["value"]
if not isinstance(message, basestring):
value = message
message = message.get('message')
else:
message = value.get('message', None)
except ValueError:
pass
exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status in ErrorCode.INVALID_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR \
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if value == '' or value is None:
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
if message == "" and 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
elif exception_class == UnexpectedAlertPresentException:
alert_text = None
if 'data' in value:
alert_text = value['data'].get('text')
elif 'alert' in value:
alert_text = value['alert'].get('text')
raise exception_class(message, screen, stacktrace, alert_text)
raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get sockets matching: @weblayer_devtools_remote_.*17062
E (make sure the app has its WebView/WebLayer configured for debugging)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py:242: WebDriverException
Assertion failed
Assertion failed
Assertion failed
相關文章
- 請問這個報錯該怎麼解決,謝謝
- offer 比較,人生十字路口大家幫幫忙 謝謝
- 求助基於 APP 騰訊 X5 的 webview 控制元件無法識別的問題APPWebView控制元件
- 求求有沒有沒睡的大佬幫忙改改
- 感謝LearnKu的大佬們的支援
- 請各位大佬幫忙看看我的 Page Object 模式用的對不對Object模式
- 收集所有能夠使用 for in 來遍歷的語言,謝謝各位大佬
- 謝謝你寫黑文!幫我們推廣這麼棒的兔基社群
- 基於騰訊x5封源庫,提高60%開發效率
- Uint8Array 我TM謝謝你不報錯哦UI
- 騰訊X5核心 WebView 實踐總結WebView
- JS求助!!哪位大佬幫幫我,解答一下。JS
- 安裝時提示錯誤,請高手幫忙解決一下
- 深夜發文。。。。求一套ERP系統,最好是PHP開發的,謝謝!PHP
- appium 進行 ios 自動化測試,報無法啟動 WebDriverAgent 會話錯誤,跪求大佬們幫忙看看~APPiOSWeb會話
- 求助:Jmeter 儲存測試計劃時,報錯 java.lang.InternalError: Could not bind shell folder to interface,求大神幫忙指導下哪裡的問題! 多謝!JMeterJavaError
- Pytest 指令碼打包成 exe 後,無法呼叫 testcase,無法獲取到 fixture,希望大佬幫忙給以指點,多謝!指令碼
- 謝謝《瞭望智庫》的鼓勵
- .NET混合開發解決方案5 WebView2執行時與分發應用WebView
- PHP大檔案上傳到阿里雲OSS,比如幾百M到一G的那種,有沒有好的解決思路,謝謝PHP阿里
- .NET混合開發解決方案14 WebView2的基本身份驗證WebView
- Appium 測試 Android 混合應用時,第二次切換到WebView時的定位問題APPAndroidWebView
- 求助:請大師幫忙看看如何優雅的求出每天不同時段的平均溫度(有圖)
- .NET混合開發解決方案16 管理WebView2的使用者資料WebView
- .NET混合開發解決方案9 WebView2控制元件的導航事件WebView控制元件事件
- 轉戰laravel文件,感謝各位大佬給出的建議Laravel
- Python抽象基類:ABC謝謝你,因為有你,溫暖了四季!Python抽象
- 謝謝,一年
- .NET混合開發解決方案6 檢測是否已安裝合適的WebView2執行時WebView
- 怎樣實現一個按天遞增的mysql欄位,大佬們幫忙想想有沒有好的解決方案MySql
- .NET混合開發解決方案24 WebView2對比CefSharp的超強優勢WebView
- 基於Spring的Web專案執行時切換資料來源的一種解決方案SpringWeb
- 基於 Web 引擎擴充套件技術的 RTC 混合開發框架實踐Web套件框架
- 測試問題思考,有些問題我自己有答案,但是我想聽聽大家的見解,謝謝!
- 關於安卓app的webview設定本地代理以及webview開發環境的搭建安卓APPWebView開發環境
- 請問新建話題是不是有問題?版主幫忙看看
- 求助大佬幫忙找一個想不起名字的功能
- 《程式人生》一個月了,我要謝謝,你、你、還有你