• 已阅

  • 翻译队伍太强大,👍 👍 👍 希望可以参加 Review

  • #1 楼 @kanchi240 你好,可以看一下这个,http://www.imooc.com/video/12541

  • 我这边 App 的情况是这样的:

    1、客户端服务端进行会话之前,客户端会对服务端下发的证书,进行验证

    2、而使用 Fiddler 抓包时,是无法对服务端下发的证书进行验证的(因为 Fiddler 没有 App 的证书,Fiddler 的证书是软件自带的)

    3、因此,我这边在开发和测试环境下,还提供了 1 个入口,就是客户端关闭对证书的验证,接受所有证书

    4、客户端关闭证书验证之后,就可以使用 Fiddler 进行抓包了。

  • 公安局都查不到吗?不会吧?
    上次我一同学说,有警察直接到他们公司来,请一个同事去警局喝茶,好像是浏览了不该看的网站。

  • #5 楼 @lihuazhang 好的,谢谢提醒

  • #1 楼 @lihuazhang

    你好,我看了那篇帖子,并尝试了

    把 appium 版本降低到 1.4.13.1 和 1.4.0,再运行脚本,还是不行(我是 win + Android)

  • #2 楼 @shljsh 你好,按照您说的,我试了一下,还是不行。

    python 代码:

    def find_toast(message, timeout, poll_frequency, driver):
        element = WebDriverWait(driver,timeout,poll_frequency).until(expected_conditions.presence_of_element_located(driver.find_element_by_xpath(message)))
        return element
    time.sleep(5)
    driver.find_element_by_id("login_account").clear()
    driver.find_element_by_id("login_account").send_keys("13168732222")
    driver.find_element_by_id("login_password_edit").clear()
    driver.find_element_by_id("login_password_edit").send_keys("1234567")
    driver.find_element_by_id("login_btn_bg_btn").click()
    
    find_toast("//*[contains(@text, '账号或密码错误')]", 5, 0.5, driver)
    

    运行日志:

    C:\Python27\python.exe F:/02_PhoneTesting/Appium/Scripts/Test1.py
    Traceback (most recent call last):
      File "F:/02_PhoneTesting/Appium/Scripts/Test1.py", line 37, in <module>
        find_toast("//*[contains(@text, '账号或密码错误')]", 5, 0.5, driver)
      File "F:/02_PhoneTesting/Appium/Scripts/Test1.py", line 26, in find_toast
        element = WebDriverWait(driver,timeout,poll_frequency).until(expected_conditions.presence_of_element_located(driver.find_element_by_xpath(message)))
      File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 258, in find_element_by_xpath
        return self.find_element(by=By.XPATH, value=xpath)
      File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 712, in find_element
        {'using': by, 'value': value})['value']
      File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute
        self.error_handler.check_response(response)
      File "C:\Python27\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.
    
  • #38 楼 @chrisjywu 请问 toast message 是中文的情况下,如何才能定位到这个 toast?我这边,日志说,没有找到 elemnt,请问如何解决

    代码是:

    def find_toast(message, timeout, poll_frequency, driver):
        element = WebDriverWait(driver,timeout,poll_frequency).until(expected_conditions.presence_of_element_located(( By.PARTIAL_LINK_TEXT, message)))
        return element
    
    time.sleep(5)
    driver.find_element_by_id("login_account").clear()
    driver.find_element_by_id("login_account").send_keys("phone_number")
    driver.find_element_by_id("login_password_edit").clear()
    driver.find_element_by_id("login_password_edit").send_keys("1234567")
    driver.find_element_by_id("login_btn_bg_btn").click()
    a = find_toast(u"账号或密码错误",5, 1, driver)
    
    日志信息是:
    
    info: [debug] Proxying command to localhost:8080
    info: [debug] Making http request with opts: {"url":"http://localhost:8080/wd/hu
    b/session/e0229ff2-96e2-de1c-5e18-2f4f03502f36/element","method":"POST","json":{
    "using":"partial link text","sessionId":"e0229ff2-96e2-de1c-5e18-2f4f03502f36","
    value":"账号或密码错误"}}
    info: [debug] Responding to client with error: {"status":7,"value":{"message":"A
    n element could not be located on the page using the given search parameters.","
    origValue":"Element was not found."},"sessionId":"e0229ff2-96e2-de1c-5e18-2f4f03
    502f36"}
    
    
  • 太棒了,很期待,专项和实践课程的开展,越快越好。。