设备信息 -- 华为手机
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '8.1.0'
desired_caps['deviceName'] = 'XKKBB19114154873'
desired_caps['appPackage'] = 'com.ffk.uotc.debug'
desired_caps['appActivity'] = 'com.ffk.uotc.mvp.ui.activity.WelcomeActivity'
desired_caps['chromedriverExecutableDir']='E:\CompanyInformation\Workplace\APPIUM\demo'
报错的代码
# 开始移动
def start_move(self, distance):
element = self.driver.find_element_by_xpath('//div[@class="geetest_slider_button"]')
# 这里就是根据移动进行调试,计算出来的位置不是百分百正确的,加上一点偏移
print("方块的宽度:" + str(element.size.get('width')))
# distance -= element.size.get('width') / 2
# distance += 25
distance += element.size.get('width') / 2
print("最后的间距:" + str(distance))
action = ActionChains(self.driver)
time.sleep(0.5)
# 初始化步调值
span = 0
while distance > 0:
span += 3
print(span)
action.click_and_hold(element).move_by_offset(span, 0).perform()
distance -= 3
# time.sleep(random.randint(10, 50) / 100)
action = ActionChains(self.driver)
# action.move_by_offset(distance, 1).perform()
action.release(on_element=element).perform()
# action.release().perform()
代码错误信息如下:
Traceback (most recent call last):
File "E:/CompanyInformation/Workplace/APPIUM/demo/Calculator.py", line 52, in <module>
b.visit_index()
File "E:\CompanyInformation\Workplace\APPIUM\demo\Verity.py", line 25, in visit_index
self.analog_drag()
File "E:\CompanyInformation\Workplace\APPIUM\demo\Verity.py", line 45, in analog_drag
self.start_move(distance)
File "E:\CompanyInformation\Workplace\APPIUM\demo\Verity.py", line 112, in start_move
action.click_and_hold(element).move_by_offset(span, 0).perform()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\action_chains.py", line 80, in perform
self.w3c_actions.perform()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\actions\action_builder.py", line 76, in perform
self.driver.execute(Command.W3C_ACTIONS, enc)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
raise wde
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\appium\webdriver\errorhandler.py", line 24, in check_response
super(MobileErrorHandler, self).check_response(response)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.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: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 501 - "unimplemented command: session/07befb9ea2b39e205abbf5611cdb76b0/actions"