打开app不会翻页,无法定位去登陆页面

来源:1-16 通过UIAutomator进行定位用户信息

慕移动0944728

2018-12-24

def get_driver():
    capabilities = {
        "platformName": "Android",
        "deviceName": "emulator-5554 ",
        "app": "E:\\杂用\\mukewang.apk",
        "appPackage": "cn.com.open.mooc",
        "appWaitActivity": "cn.com.open.mooc.index.splash.MCSplashActivity",
        "noReset": "true"
    }
    driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", capabilities)
    return driver

def go_login():
    # print driver.find_element_by_id('cn.com.open.mooc:id/tv_go_login')
    driver.find_element_by_id('cn.com.open.mooc:id/tv_go_login').click()
    time.sleep(6)

def login():
    driver.find_element_by_id('cn.com.open.mooc:id/account_edit').send_keys('18103831691')
    time.sleep(3)
    driver.find_element_by_id('cn.com.open.mooc:id/password_edit').send_keys('jmy.')
    time.sleep(3)
    driver.find_element_by_id('cn.com.open.mooc:id/login_lable').click()
    time.sleep(6)

driver = get_driver()
go_login()
login()

运行报错
"D:\Program Files(x86)\PycharmProjects\test1\venv\Scripts\python.exe" "D:/Program Files(x86)/PycharmProjects/test1/appiumpython/start_appium.py"
Traceback (most recent call last):
  File "D:/Program Files(x86)/PycharmProjects/test1/appiumpython/start_appium.py", line 128, in <module>
    go_login()
  File "D:/Program Files(x86)/PycharmProjects/test1/appiumpython/start_appium.py", line 79, in go_login
    driver.find_element_by_id('cn.com.open.mooc:id/tv_go_login').click()
  File "D:\Program Files(x86)\PycharmProjects\test1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 360, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "D:\Program Files(x86)\PycharmProjects\test1\venv\lib\site-packages\appium\webdriver\webdriver.py", line 219, in find_element
    'value': value})['value']
  File "D:\Program Files(x86)\PycharmProjects\test1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "D:\Program Files(x86)\PycharmProjects\test1\venv\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
    raise wde
selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.

Process finished with exit code 1

appium服务报错
[HTTP] <-- POST /wd/hub/session/66102c7a-efc3-4112-a862-03388ecf36c4/element 404

写回答

1回答

Mushishi

2018-12-24

你好,提示你没有找到元素,慕课网的建议你换一个手机试一试

0
2
Mushishi
回复
慕移动0944728
你好那你就只能按照坐标去了,拿到这个元素的坐标,然后往后面计算坐标。
2018-12-26
共2条回复

Python主讲移动端自动化测试框架Appium

APP自动化基础知识、po模型、关键字模型、服务自动化、持续集成

1508 学习 · 1333 问题

查看课程