appium滑动粉丝列表,貌似不太稳定
来源:-10 短视频网站appium模拟滑动操作2
Momo2k19123
2019-08-10
大壮老师好
【问题1】通过appium控制app滑动粉丝列表貌似整体都很不稳定。
试跑了10次, 其中有7到8次会, 报以下错误, 就是要么不滑动就直接报错, 要么就滑动1下, 或者滑动2到3下, 就报错. 还有2次, 基本上是还没到粉丝列表页呢, 程序就挂了。
Traceback (most recent call last):
File "E:/Project/Douyin/handle_appium_douyin.py", line 84, in <module>
if '没有更多了' in driver.page_source: # driver.page_source方法获取页面的内容
File "E:ProjectDouyinenvlibsite-packagesseleniumwebdriver
emotewebdriver.py", line 679, in page_source
return self.execute(Command.GET_PAGE_SOURCE)['value']
File "E:ProjectDouyinenvlibsite-packagesseleniumwebdriver
emotewebdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "E:ProjectDouyinenvlibsite-packagesappiumwebdrivererrorhandler.py", line 29, in check_response
raise wde
File "E:ProjectDouyinenvlibsite-packagesappiumwebdrivererrorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "E:ProjectDouyinenvlibsite-packagesseleniumwebdriver
emoteerrorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Failed to Dump Window Hierarchy
Process finished with exit code 1
--------------------------------------------------------------------------------------------------------
【问题2】长时间等待后报错。
在搜索框中自动填写抖音id之前, 经过长时间等待(超过60秒), 再又是长时间等待(超过20秒), 还没有点击搜索按钮, 最后就报错。

报错如下
Traceback (most recent call last):
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 603, in urlopen
chunked=chunked)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 387, in _make_request
six.raise_from(e, None)
File “”, line 2, in raise_from
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 383, in _make_request
httplib_response = conn.getresponse()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 1331, in getresponse
response.begin()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 297, in begin
version, status, reason = self._read_status()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “E:/Project/Douyin/handle_appium_douyin.py”, line 43, in
driver.find_element_by_xpath("//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]").send_keys(“145651081”) # 黑脸v 145651081 CXSF666
File “E:\Project\Douyin\venv\lib\site-packages\selenium\webdriver\remote\webelement.py”, line 479, in send_keys
’value’: keys_to_typing(value)})
File “E:\Project\Douyin\venv\lib\site-packages\selenium\webdriver\remote\webelement.py”, line 633, in _execute
return self._parent.execute(command, params)
File “E:\Project\Douyin\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 319, in execute
response = self.command_executor.execute(driver_command, params)
File “E:\Project\Douyin\venv\lib\site-packages\selenium\webdriver\remote\remote_connection.py”, line 374, in execute
return self._request(command_info[0], url, body=data)
File “E:\Project\Douyin\venv\lib\site-packages\selenium\webdriver\remote\remote_connection.py”, line 397, in _request
resp = self._conn.request(method, url, body=body, headers=headers)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\request.py”, line 72, in request
**urlopen_kw)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\request.py”, line 150, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\poolmanager.py”, line 326, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\util\retry.py”, line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\packages\six.py”, line 685, in reraise
raise value.with_traceback(tb)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 603, in urlopen
chunked=chunked)
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 387, in _make_request
six.raise_from(e, None)
File “”, line 2, in raise_from
File “E:\Project\Douyin\venv\lib\site-packages\urllib3\connectionpool.py”, line 383, in _make_request
httplib_response = conn.getresponse()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 1331, in getresponse
response.begin()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 297, in begin
version, status, reason = self._read_status()
File “C:\Users\HP\AppData\Local\Programs\Python\Python36\Lib\http\client.py”, line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’,))
--------------------------------------------------------------------------------------------------------
代码如下
import time
from appium import webdriver
# 用来等待元素控件
from selenium.webdriver.support.ui import WebDriverWait
# 将原来考研帮的参数更新成为抖音app的参数
cap = {
"platformName": "Android",
"platformVersion": "5.0.2", # LRX22G 后面这串不要写入代码
"deviceName": "132a5bd7",
"appPackage": "com.ss.android.ugc.aweme",
"appActivity": "com.ss.android.ugc.aweme.splash.SplashActivity",
"noReset": True,
"unicodekeyboard":True, # 增加这个参数是因为还要输入中文
"resetkeyboard":True, # 所使用的是appium中的输入法因此使用完还需要还原
}
# 启动app
driver = webdriver.Remote("http://localhost:4723/wd/hub",cap)
def get_size():
x = driver.get_window_size()['width']
y = driver.get_window_size()['height']
return(x,y)
# 定位【搜索放大镜】并点击
try:
# 如果10秒钟内发现有这个搜索的放大镜控件我们就
if WebDriverWait(driver, 10).until(lambda x:x.find_element_by_id("com.ss.android.ugc.aweme:id/aaz")): # id/aci
driver.find_element_by_id("com.ss.android.ugc.aweme:id/aaz").click()
except: # 如果没有出现正常页面比如出现了广告页面所以这里要用try except
pass
# 定位【搜索框】输入抖音id
if WebDriverWait(driver,10).until(lambda x:x.find_element_by_xpath("//android.widget.EditText[@resource-id='com.ss.android.ugc.aweme:id/a47']")):
driver.find_element_by_xpath("//android.widget.EditText[@resource-id='com.ss.android.ugc.aweme:id/a47']").click()
driver.find_element_by_xpath("//android.widget.EditText[@resource-id='com.ss.android.ugc.aweme:id/a47']").send_keys("145651081") # 黑脸v 145651081 CXSF666
while driver.find_element_by_xpath("//android.widget.EditText[@resource-id='com.ss.android.ugc.aweme:id/a47']").text !="145651081": # 如果不等于黑脸v id则重新输入
driver.find_element_by_xpath(
"//android.widget.EditText[@resource-id='com.ss.android.ugc.aweme:id/a47']").send_keys("145651081") # 输入黑脸v
time.sleep(0.3)
# 定位【搜索按钮】并点击
driver.find_element_by_xpath("//android.widget.TextView[@resource-id='com.ss.android.ugc.aweme:id/a49']").click()
# 定位【用户tab】并点击
# 判断下如果没有则需要等待
if WebDriverWait(driver, 10).until(lambda x:x.find_element_by_xpath("//android.widget.LinearLayout/android.widget.TextView[3]")):
# 点击【用户tab】
driver.find_element_by_xpath("//android.widget.LinearLayout/android.widget.TextView[3]").click()
# 判断是否有【关注】按钮如果有则点击头像
if WebDriverWait(driver, 10).until(lambda x:x.find_element_by_xpath("//android.widget.TextView[@resource-id='com.ss.android.ugc.aweme:id/bnk']")):
# 点击【用户头像】
driver.find_element_by_xpath("//android.widget.RelativeLayout[@resource-id='com.ss.android.ugc.aweme:id/aq4']/android.widget.ImageView[1]").click()
# 判断是否有【粉丝】标签
if WebDriverWait(driver, 10).until(
lambda x: x.find_element_by_xpath("//android.widget.LinearLayout[@resource-id='com.ss.android.ugc.aweme:id/a5r']/android.widget.TextView[2]")):
# 若有点击【粉丝】标签
driver.find_element_by_xpath(
"//android.widget.LinearLayout[@resource-id='com.ss.android.ugc.aweme:id/a5r']/android.widget.TextView[2]").click()
time.sleep(1)
# 获取到手机界面的尺寸长、宽
l = get_size()
x1 = int(l[0]*0.5)
y1 = int(l[1]*0.9) # x1,y1组成了滑动的起始点在屏幕正中间下方(0.9)的位置
y2 = int(l[1]*0.20) # 往上滑动目的坐标y坐标滑到距离上方0.15的位置
# 调用这些坐标值
while True:
# 需要定义一个结束条件:【没有更多了~】
if '没有更多了' in driver.page_source: # driver.page_source方法获取页面的内容
break
else:
driver.swipe(x1,y1,x1,y2) # swipe方法是滑动鼠标位置x1,y1从哪x1,y2到哪
time.sleep(1) # 滑动太快可能请求不到数据
appium log如下
--------------------------------------------------------------------------------------------------------
[info] [35m[Appium][39m Welcome to Appium v1.9.0
[info] [35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session[39m
[info] [35m[HTTP][39m [90m{“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“5.0.2”,“appium:deviceName”:“132a5bd7”,“appium:appPackage”:“com.ss.android.ugc.aweme”,“appium:appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“appium:noReset”:true,“appium:unicodekeyboard”:true,“appium:resetkeyboard”:true}]},“desiredCapabilities”:{“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“132a5bd7”,“appPackage”:“com.ss.android.ugc.aweme”,“appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“noReset”:true,“unicodekeyboard”:true,“resetkeyboard”:true}}[39m
[debug] [35m[MJSONWP][39m Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“132a5bd7”,“appPackage”:“com.ss.android.ugc.aweme”,“appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“noReset”:true,“unicodekeyboard”:true,“resetkeyboard”:true},null,{“firstMatch”:[{“platformName”:“Android”,“appium:platformVersion”:“5.0.2”,“appium:deviceName”:“132a5bd7”,“appium:appPackage”:“com.ss.android.ugc.aweme”,“appium:appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“appium:noReset”:true,“appium:unicodekeyboard”:true,“appium:resetkeyboard”:true}]}]
[debug] [35m[BaseDriver][39m Event ‘newSessionRequested’ logged at 1565432592629 (18:23:12 GMT+0800 (中国标准时间))
[info] [35m[Appium][39m Creating new AndroidDriver (v3.7.0) session
[info] [35m[Appium][39m Capabilities:
[info] [35m[Appium][39m platformName: Android
[info] [35m[Appium][39m platformVersion: 5.0.2
[info] [35m[Appium][39m deviceName: 132a5bd7
[info] [35m[Appium][39m appPackage: com.ss.android.ugc.aweme
[info] [35m[Appium][39m appActivity: com.ss.android.ugc.aweme.splash.SplashActivity
[info] [35m[Appium][39m noReset: true
[info] [35m[Appium][39m unicodekeyboard: true
[info] [35m[Appium][39m resetkeyboard: true
[debug] [35m[BaseDriver][39m W3C capabilities {“alwaysMatch”:{“platformNa… and MJSONWP desired capabilities {“platformName”:“Android”,”… were provided
[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {“alwaysMatch”:{“platformNa…
[warn] [35m[BaseDriver][39m The following capabilities were provided, but are not recognized by appium: unicodekeyboard, resetkeyboard.
[info] [35m[BaseDriver][39m Session created with session id: c6d5a531-a70e-4125-9841-208149452020[info] [35m[AndroidDriver][39m Java version is: 1.8.0_181
[info] [35m[AndroidDriver][39m Retrieving device list
[debug] [35m[ADB][39m Trying to find a connected android device
[debug] [35m[ADB][39m Getting connected devices…
[debug] [35m[ADB][39m 1 device(s) connected
[info] [35m[AndroidDriver][39m Looking for a device with Android ‘5.0.2’
[debug] [35m[ADB][39m Setting device id to 132a5bd7
[info] [35m[ADB][39m Getting device platform version
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell getprop ro.build.version.release’
[debug] [35m[ADB][39m Current device property ‘ro.build.version.release’: 5.0.2
[info] [35m[AndroidDriver][39m Using device: 132a5bd7
[debug] [35m[ADB][39m Setting device id to 132a5bd7
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell getprop ro.build.version.sdk’
[debug] [35m[ADB][39m Current device property ‘ro.build.version.sdk’: 21
[debug] [35m[ADB][39m Device API level: 21
[info] [35m[AndroidDriver][39m App file was not listed, instead we’re going to run com.ss.android.ugc.aweme directly on the device
[debug] [35m[AndroidDriver][39m Checking whether package is present on the device
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell pm list packages com.ss.android.ugc.aweme’[info] [35m[AndroidDriver][39m Starting Android session
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 wait-for-device’
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell echo ping’
[debug] [35m[AndroidDriver][39m Pushing settings apk to device…
[debug] [35m[ADB][39m Getting install status for io.appium.settings
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell pm list packages io.appium.settings’[debug] [35m[ADB][39m App is installed
[debug] [35m[ADB][39m Getting package info for ‘io.appium.settings’
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell dumpsys package io.appium.settings’[debug] [35m[ADB][39m The installed ‘io.appium.settings’ package does not require upgrade (‘2.3.0’ >= ‘2.3.0’)
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell ps’
[debug] [35m[AndroidDriver][39m io.appium.settings is already running. There is no need to reset its permissions.
[debug] [35m[ADB][39m Device API level: 21
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell settings put secure mock_location 1’[warn] [35m[AndroidDriver][39m setDeviceLanguageCountry requires language or country.
[warn] [35m[AndroidDriver][39m Got language: ‘undefined’ and country: ‘undefined’
[debug] [35m[Logcat][39m Starting logcat capture
[debug] [35m[AndroidDriver][39m Pushing unlock helper app to device…
[debug] [35m[ADB][39m Getting install status for io.appium.unlock
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell pm list packages io.appium.unlock’[debug] [35m[ADB][39m App is installed
[debug] [35m[ADB][39m Getting package info for ‘io.appium.unlock’
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell dumpsys package io.appium.unlock’
[debug] [35m[ADB][39m The installed ‘io.appium.unlock’ package does not require upgrade (‘2.0.0’ >= ‘2.0.0’)
[info] [35m[ADB][39m Getting device platform version
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell getprop ro.build.version.release’
[debug] [35m[ADB][39m Current device property ‘ro.build.version.release’: 5.0.2
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell wm size’[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell getprop ro.product.model’
[debug] [35m[ADB][39m Current device property ‘ro.product.model’: MI 2
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell getprop ro.product.manufacturer’
[debug] [35m[ADB][39m Current device property ‘ro.product.manufacturer’: Xiaomi
[warn] [35m[AndroidDriver][39m No app sent in, not parsing package/activity
[debug] [35m[AndroidDriver][39m No app capability. Assuming it is already on the device
[debug] [35m[AndroidBootstrap][39m Watching for bootstrap disconnect
[debug] [35m[ADB][39m Forwarding system: 4724 to device: 4724
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 forward tcp:4724 tcp:4724’[debug] [35m[UiAutomator][39m Starting UiAutomator
[debug] [35m[UiAutomator][39m Moving to state ‘starting’
[debug] [35m[UiAutomator][39m Parsing uiautomator jar
[debug] [35m[UiAutomator][39m Found jar name: ‘AppiumBootstrap.jar’
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 push C:UsersHPAppDataLocalProgramsAppium
esourcesapp
ode_modulesappium
ode_modulesappium-android-bootstrapootstrapinAppiumBootstrap.jar /data/local/tmp/’
[debug] [35m[ADB][39m Attempting to kill all uiautomator processes
[debug] [35m[ADB][39m Getting all processes with uiautomator
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell ps’
[debug] [35m[ADB][39m Attempting to kill process 18447
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill -0 18447’[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill 18447’
[error] [35m[UiAutomator][39m UiAutomator exited unexpectedly with code 0, signal null
[debug] [35m[UiAutomator][39m Moving to state ‘stopped’
[debug] [35m[AndroidDriver][39m Shutting down Android driver
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell am force-stop com.ss.android.ugc.aweme’
[warn] [35m[Appium][39m Closing session, cause was ‘UiAUtomator shut down unexpectedly’
[info] [35m[Appium][39m Removing session 0f2bb49c-b4b1-4b10-9e51-de71879f3bd9 from our master session list[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill 18447’[debug] [35m[ADB][39m Pressing the HOME button
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell input keyevent 3’
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill 18447’[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill 18447’
[warn] [35m[ADB][39m Cannot kill process 18447 in 1000 ms. Trying to force kill…
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell kill -9 18447’[debug] [35m[UiAutomator][39m Starting UIAutomator
[debug] [35m[ADB][39m Creating ADB subprocess with args: [”-P",5037,"-s",“132a5bd7”,“shell”,“uiautomator”,“runtest”,“AppiumBootstrap.jar”,"-c",“io.appium.android.bootstrap.Bootstrap”,"-e",“pkg”,“com.ss.android.ugc.aweme”,"-e",“disableAndroidWatchers”,false,"-e",“acceptSslCerts”,false][debug] [35m[UiAutomator][39m Moving to state ‘online’
[info] [35m[AndroidBootstrap][39m Android bootstrap socket is now connected
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell dumpsys window’
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Registered crash watchers.
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Client connected[info] [35m[AndroidDriver][39m Screen already unlocked, doing nothing
[debug] [35m[ADB][39m Device API level: 21
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell am start -W -n com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.splash.SplashActivity -S’
[debug] [35m[AndroidDriver][39m Not cleaning generated files. Add clearSystemFiles capability if wanted.[info] [35m[Appium][39m New AndroidDriver session created successfully, session c6d5a531-a70e-4125-9841-208149452020 added to master session list
[debug] [35m[BaseDriver][39m Event ‘newSessionStarted’ logged at 1565432608616 (18:23:28 GMT+0800 (中国标准时间))
[debug] [35m[W3C][39m Responding to client with driver.createSession() result: {“capabilities”:{“platform”:“LINUX”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“132a5bd7”,“appPackage”:“com.ss.android.ugc.aweme”,“appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“noReset”:true,“unicodekeyboard”:true,“resetkeyboard”:true},“platformName”:“Android”,“platformVersion”:“5.0.2”,“deviceName”:“132a5bd7”,“appPackage”:“com.ss.android.ugc.aweme”,“appActivity”:“com.ss.android.ugc.aweme.splash.SplashActivity”,“noReset”:true,“unicodekeyboard”:true,“resetkeyboard”:true,“deviceUDID”:“132a5bd7”,“deviceScreenSize”:“720x1280”,“deviceModel”:“MI 2”,“deviceManufacturer”:“Xiaomi”}}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session [39m[32m200[39m [90m15988 ms - 864[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element[39m
[info] [35m[HTTP][39m [90m{“using”:“id”,“value”:“com.ss.android.ugc.aweme:id/aaz”}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.findElement() with args: [“id”,“com.ss.android.ugc.aweme:id/aaz”,“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 0 ms for condition
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.ss.android.ugc.aweme:id/aaz”,“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.ss.android.ugc.aweme:id/aaz”,“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding ‘com.ss.android.ugc.aweme:id/aaz’ using ‘ID’ with the contextId: ‘’ multiple: false
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.ss.android.ugc.aweme:id/aaz][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“1”}}
[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[W3C][39m Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“1”}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element [39m[32m200[39m [90m309 ms - 53[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element[39m
[info] [35m[HTTP][39m [90m{“using”:“id”,“value”:“com.ss.android.ugc.aweme:id/aaz”}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.findElement() with args: [“id”,“com.ss.android.ugc.aweme:id/aaz”,“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 0 ms for condition
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.ss.android.ugc.aweme:id/aaz”,“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.ss.android.ugc.aweme:id/aaz”,“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding ‘com.ss.android.ugc.aweme:id/aaz’ using ‘ID’ with the contextId: ‘’ multiple: false
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.ss.android.ugc.aweme:id/aaz][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“2”}}
[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[W3C][39m Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“2”}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element [39m[32m200[39m [90m2721 ms - 53[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/2/click[39m
[info] [35m[HTTP][39m [90m{“id”:“2”}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.click() with args: [“2”,“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“2”}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“2”}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: click[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:true}
[debug] [35m[W3C][39m Responding to client with driver.click() result: true
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/2/click [39m[32m200[39m [90m10215 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element[39m
[info] [35m[HTTP][39m [90m{“using”:“xpath”,“value”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]"}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.findElement() with args: [“xpath”,"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 0 ms for condition
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding ‘//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]’ using ‘XPATH’ with the contextId: ‘’ multiple: false[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=0][debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“3”}}
[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[W3C][39m Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“3”}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element [39m[32m200[39m [90m11455 ms - 53[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element[39m
[info] [35m[HTTP][39m [90m{“using”:“xpath”,“value”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]"}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.findElement() with args: [“xpath”,"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 0 ms for condition
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding ‘//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]’ using ‘XPATH’ with the contextId: ‘’ multiple: false[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=0][debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“4”}}
[debug] [35m[W3C][39m Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“4”}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element [39m[32m200[39m [90m10436 ms - 53[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/4/click[39m
[info] [35m[HTTP][39m [90m{“id”:“4”}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.click() with args: [“4”,“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“4”}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“4”}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: click[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:true}
[debug] [35m[W3C][39m Responding to client with driver.click() result: true
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/4/click [39m[32m200[39m [90m10296 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element[39m
[info] [35m[HTTP][39m [90m{“using”:“xpath”,“value”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]"}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.findElement() with args: [“xpath”,"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[BaseDriver][39m Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[debug] [35m[BaseDriver][39m Waiting up to 0 ms for condition
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]",“context”:"",“multiple”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: find
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Finding ‘//android.widget.EditText[@resource-id=‘com.ss.android.ugc.aweme:id/a47’]’ using ‘XPATH’ with the contextId: ‘’ multiple: false[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=0][debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“5”}}
[debug] [35m[W3C][39m Responding to client with driver.findElement() result: {“element-6066-11e4-a52e-4f735466cecf”:“5”}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element [39m[32m200[39m [90m11270 ms - 53[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m–>[39m [37mPOST[39m [37m/wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/5/value[39m
[info] [35m[HTTP][39m [90m{“text”:“145651081”,“value”:[“1”,“4”,“5”,“6”,“5”,“1”,“0”,“8”,“1”],“id”:“5”}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.setValue() with args: [[“1”,“4”,“5”,“6”,“5”,“1”,“0”,“8”,“1”],“5”,“c6d5a531-a70e-4125-9841-208149452020”]
[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“5”,“text”:“145651081”,“replace”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“5”,“text”:“145651081”,“replace”:false}}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type ACTION
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command action: setText
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Using element passed in: 5[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Text remains after clearing, but it appears to be hint text.[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Text not cleared. Assuming remainder is hint text.
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Sending plain text to element: 145651081[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/c6d5a531-a70e-4125-9841-208149452020/element/5/value [39m[32m-[39m [90m- ms - -[39m
[info] [35m[HTTP][39m [90m[39m[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:true}
[debug] [35m[W3C][39m Responding to client with driver.setValue() result: true[warn] [35m[BaseDriver][39m Shutting down because we waited 60 seconds for a command
[debug] [35m[AndroidDriver][39m Shutting down Android driver
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell am force-stop com.ss.android.ugc.aweme’
[warn] [35m[Appium][39m Closing session, cause was ‘New Command Timeout of 60 seconds expired. Try customizing the timeout using the ‘newCommandTimeout’ desired capability’
[info] [35m[Appium][39m Removing session c6d5a531-a70e-4125-9841-208149452020 from our master session list[debug] [35m[ADB][39m Pressing the HOME button
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell input keyevent 3’[debug] [35m[AndroidBootstrap][39m Sending command to android: {“cmd”:“shutdown”}
[debug] [35m[AndroidBootstrap][39m Received command result from bootstrap
[debug] [35m[UiAutomator][39m Shutting down UiAutomator
[debug] [35m[UiAutomator][39m Moving to state ‘stopping’
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“shutdown”}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
[debug] [35m[AndroidBootstrap][39m [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [35m[AndroidBootstrap][39m [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [35m[UiAutomator][39m UiAutomator shut down normally
[debug] [35m[UiAutomator][39m Moving to state ‘stopped’
[debug] [35m[ADB][39m Attempting to kill all uiautomator processes
[debug] [35m[ADB][39m Getting all processes with uiautomator
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell ps’
[info] [35m[ADB][39m No uiautomator process found to kill, continuing…
[debug] [35m[UiAutomator][39m Moving to state ‘stopped’
[debug] [35m[Logcat][39m Stopping logcat capture
[debug] [35m[ADB][39m Running ‘C:SDKplatform-toolsadb.exe -P 5037 -s 132a5bd7 shell am force-stop io.appium.unlock’[debug] [35m[AndroidDriver][39m Not cleaning generated files. Add clearSystemFiles capability if wanted.
--------------------------------------------------------------------------------------------------------
有点心塞
感觉今日不宜写代码、跑代码
烦请大壮老师指点万分感谢
1回答
-
Momo2k19123
提问者
2019-08-10
跑这段代码,我试了一下午,从今天12点半一直到18点,一直在反复折腾。效率太低了。
为了巩固与复习,我都把课程做成自己可以理解的ppt。每周六、日进行,本来想这周搞定所有课程内容。看来要泡汤了。
---
我的手机型号是小米2S
---
022019-08-31
相似问题
