appium-运行case问题求助

在运行case中发现有两个问题无法理解,辛苦老师解答:
1.设置了noReset,但是还是会重新启动雪球app?
2.设置了中文输入的处理,但是没有输入中文导致报错?
代码如下:运行前已经开启了appium 并指定开启了雪球app

import pytest
from appium import webdriver

class Testfind:
    #初始化用例,设置capbility参数,设置隐式等待时间
    def setup(self):
        desired_caps = {
            "platformName": "android",
            "platformVersion": "10",
            "deviceName": "ec76ef18",
            "appPackage": "com.xueqiu.android",
            "appActivity": ".view.WelcomeActivityAlias",
            "noReset": 'true',
            "dontStopAppOnReset":'true',
            "skipDeviceInitialization":'true',
            "unicodeKeyBoard": 'true',
            "resetKeyBoard": "true"
        }

        self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
        self.driver.implicitly_wait(5)

    def teardown(self):
        self.driver.quit()

    def testsearch2(self):
        '''
        1.打开 雪球app
        2.点击搜索输入框
        3.向搜索框框中输入“阿里巴巴”
        4.在搜索结果页选择“阿里巴巴”,然后进行点击
        5.获取这只上 阿里巴巴的股价,并判断这只股价的价格>200
        '''
        el1 = self.driver.find_element_by_id("com.xueqiu.android:id/tv_search")
        el1.click()
        el2 = self.driver.find_element_by_id("com.xueqiu.android:id/search_input_text")
        el2.send_keys("阿里巴巴")
        self.driver.find_element_by_xpath("//*[@resource-id = 'com.xueqiu.android:id/name' and @text = '阿里巴巴']").click()
        current_price = self.driver.find_element_by_id("com.xueqiu.android:id/current_price").text
        assert current_price > 200

问题2具体报错信息:应该是没有输入“阿里巴巴”导致没有显示搜索结果页,无法定位元素

    def testsearch2(self):
        '''
        1.打开 雪球app
        2.点击搜索输入框
        3.向搜索框框中输入“阿里巴巴”
        4.在搜索结果页选择“阿里巴巴”,然后进行点击
        5.获取这只上 阿里巴巴的股价,并判断这只股价的价格>200
        '''
        el1 = self.driver.find_element_by_id("com.xueqiu.android:id/tv_search")
        el1.click()
        el2 = self.driver.find_element_by_id("com.xueqiu.android:id/search_input_text")
        el2.send_keys("阿里巴巴")
>       self.driver.find_element_by_xpath("//*[@resource-id = 'com.xueqiu.android:id/name' and @text = '阿里巴巴']").click()
问题1:

appium官网对于noReset的解释:
Do not stop app, do not clear app data, and do not uninstall apk.
http://appium.io/docs/en/writing-running-appium/other/reset-strategies/index.html
我看到你有一个driver.quit。把这个注释掉看看是否还会出现你说的场景。

问题2:

需要补充报错信息

pycharm中的报错信息
>       raise exception_class(message, screen, stacktrace)
E       selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.

D:\python3.7\lib\site-packages\selenium\webdriver\remote\errorhandler.py:242: NoSuchElementException

Assertion failed

Assertion failed
appium日志信息:
send_key"阿里巴巴"信息
[HTTP] --> POST /wd/hub/session/5683ff3c-1b4b-4ef3-803b-04dd415b12da/element/2/value
[HTTP] {"text":"阿里巴巴","value":["阿","里","巴","巴"],"id":"2"}
[W3C (5683ff3c)] Calling AppiumDriver.setValue() with args: [["阿","里","巴","巴"],"2","5683ff3c-1b4b-4ef3-803b-04dd415b12da"]
[AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:setText","params":{"elementId":"2","text":"阿里巴巴","replace":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:setText","params":{"elementId":"2","text":"阿里巴巴","replace":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using element passed in: 2
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Attempting to clear using UiObject.clearText().
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text remains after clearing, but it appears to be hint text.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Text not cleared. Assuming remainder is hint text.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Sending plain text to element: 阿里巴巴
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":true}
[AndroidBootstrap] Received command result from bootstrap
[W3C (5683ff3c)] Responding to client with driver.setValue() result: true


查找搜索结果页“阿里巴巴”日志信息
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@resource-id = 'com.xueqiu.android:id/name' and @text = '阿里巴巴']' using 'XPATH' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding '//*[@resource-id = 'com.xueqiu.android:id/name' and @text = '阿里巴巴']' using 'XPATH' with the contextId: '' multiple: false
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":7,"value":"No element found"}
[AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Matched JSONWP error code 7 to NoSuchElementError
[W3C (5683ff3c)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
[W3C (5683ff3c)]     at AndroidDriver.helpers.findElOrEls (D:\appium2\resources\app\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
[W3C (5683ff3c)]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session/5683ff3c-1b4b-4ef3-803b-04dd415b12da/element 404 5064 ms -

元素定位不到先加死等尝试一下。如果加了死等即time.sleep,还不行就要验证一下是不是定位写错啦

desired_caps[“unicodeKeyBoard”] = ‘true’

desired_caps[“resetKeyBoard”] = ‘true’

desired_caps[“unicodeKeyboard”] = True
desired_caps[“resetKeyboard”] = True
我配置中改成第二种方式就可以输入中文了,想问问 这两种方式有什么区别吗?为什么只有第二种方式可行