UiAutomator2 測試 H5 頁面,切換 webview 後報沒有找到對應的 ChromeDriver 版本
測試手機:
華為/vivo手機,webView版本是78.0的(其他手機不會出現下面的問題,如:小米、Honor)
前置描述
- APP已經開啟Debug模式(用appium操作是沒問題的)
- 用Chome瀏覽器檢視'chrome://inspect/#devices', 版本如下
現象
- chromedriver例項化後,發現會拉起本地Chrome瀏覽器
- 接著就報ChromeDriver版本不對
####相關日誌如下:
2020-12-24 15:57:40,404 conftest:INFO:mothod:usb
[W 201224 15:57:40 __init__:203] atx-agent has something wrong, auto recovering
[D 201224 15:57:40 __init__:286] device UJKDU20611008827 is online
[I 201224 15:57:40 init:155] uiautomator2 version: 2.11.0
2020-12-24 15:57:41,438 conftest:INFO:連線裝置:UJKDU20611008827
2020-12-24 15:57:44,776 conftest:INFO:啟動APP成功...
2020-12-24 15:57:47,942 conftest:INFO:切換chromedriver前,先清除chromedriver程式!!
2020-12-24 15:57:49,943 conftest:INFO:start chromedriver instance
2020-12-24 15:57:49,944 conftest:INFO:chrome_driver_path: /Users/leedarson/Documents/codes/python_workplace/Arnoo_ATX2/chromedriver/Darwin/78/chromedriver
Starting ChromeDriver 78.0.3904.105 (60e2d8774a8151efa6a00b1f358371b1e0e07ee2-refs/branch-heads/3904@{#877}) on port 9527
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
FAILED
=================================== FAILURES ===================================
___________ TestDistributionNetwork.test_distribution_network_by_ap ____________
self = <cases.distribution_network.test_distribution_network.TestDistributionNetwork object at 0x104c276d0>
common_driver = <uiautomator2.Device object at 0x104c91e80>
env = <tools.mod_config.ReadConfig object at 0x104cb42e0>
log = <tools.Logger.Log object at 0x104cb41c0>, udid = 'UJKDU20611008827'
device_info = {'device_wifi': '9042', 'phone_model': 'norve7', 'phone_name': 'huawei', 'search_keyword': 'Wi-Fi F', ...}
@allure.story('AP配網測試')
def test_distribution_network_by_ap(self, common_driver, env, log, udid, device_info):
allure.dynamic.title("機型[{}]-裝置[{}]".format(device_info['phone_name'], device_info['device_wifi']))
countdown = 130 # 倒數計時時間
app_package = env.get_device("app_package")
app_activity = env.get_device("app_activity")
search_keyword = device_info['search_keyword']
device_wifi = device_info['device_wifi']
phone_name = device_info['phone_name']
enable_wifi = env.get_wifi_device_info('enable_wifi')
wifi_password = env.get_wifi_device_info('wifi_password')
ssid_list_wifi = env.get_wifi_device_info('ssid_list_wifi')
statistical_duration = env.get_wifi_device_info("statistical_duration") # 配網時長
u2 = common_driver
common = CommonMethod(u2, log, udid, app_package)
> driver = ChromeDriver(u2, log, common, phone_name).driver()
cases/distribution_network/test_distribution_network.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tools/chrome_driver.py:70: in driver
dr = webdriver.Remote('http://localhost:%d' % self._port, capabilities)
/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:157: in __init__
self.start_session(capabilities, browser_profile)
/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:252: in start_session
response = self.execute(Command.NEW_SESSION, parameters)
/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py:321: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x104cd9430>
response = {'status': 500, 'value': '{"value":{"error":"session not created","message":"session not created: This version of Chro...fff6ef68109 _pthread_start + 148\\n18 libsystem_pthread.dylib 0x00007fff6ef63b8b thread_start + 15\\n"}}'}
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', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
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.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 78
/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py:242: SessionNotCreatedException
------------------------------ Captured log setup ------------------------------
麻煩幫忙看下
相關文章
- 關於微信 H5 頁面切換 webview 的問題H5WebView
- Appium 關於微信 H5 頁面切換 webview 的問題APPH5WebView
- 快速構建H5單頁面切換應用H5
- H5單頁面手勢滑屏切換原理H5
- 小程式webview跳轉頁面後沒有返回按鈕完美解決方案WebView
- 對h5頁面的測試方式H5
- Appium 測試 Android 混合應用時,第二次切換到WebView時的定位問題APPAndroidWebView
- SAP Commerce開發之如何找到某個頁面對應的JSP實現頁面JS
- 如何例項化不同頁面物件對應不同的 iframe,而不用頻繁切換物件
- RAC的VIP切換測試
- VUE-cli 3.0 版本本地開發沒有問題,build之後開啟頁面空白就報錯。VueUI
- nacos實現對minio的動態版本切換
- 希望找到的這幾個MVC面試題對各位有幫助MVC面試題
- WPF手動實現切換頁面
- 應屆生沒經驗,怎樣才能找到軟體測試的工作?
- 邦芒面試:巧妙應對面試中的最後提問面試
- 切換java版本Java
- 切換 PHP 版本PHP
- 切換電腦頁面、視窗快捷鍵
- CSS實現頁面切換時的滑動效果CSS
- 請問有沒有可以測試微信小程式 / 支付寶小程式的頁面渲染時間的工具?微信小程式
- oracle 跨小版本dg切換應用補丁報錯處理Oracle
- web頁面測試Web
- iOS 封裝頁數控制,點選NavigationTabBar切換頁面iOS封裝NavigationtabBar
- rf+appiumlibrary 測試安卓 H5 頁面,新出現的 div 定位不到APP安卓H5
- 邦芒支招:面試失敗後的應對方法面試
- 關於PHP的切換版本PHP
- valet 切換 PHP 版本PHP
- centos 切換 jdk 版本CentOSJDK
- GCC 多版本切換GC
- jdk 多版本切換JDK
- lnmp 切換PHP版本LNMPPHP
- Mac切換Python版本MacPython
- 有沒有對測試 PB 統計自動化研究的小夥伴
- 微信小程式頁面功能-----標籤切換微信小程式
- vue 獲取頁面詳情後 切換頁面時 如何監聽使用者是否修改過資訊Vue
- native 切換 webview 失敗,求大神協助WebView
- win10 edge瀏覽器切換網頁沒有聲音該怎麼辦Win10瀏覽器網頁