【发布时间】:2021-03-28 04:59:02
【问题描述】:
我对机器人框架非常陌生,在 pycharm 工作。 我只想在当前字段中输入一些文本。但这些都不起作用。 我试过了
Press Keycode a
Press Keys text_field q
input text ${mylocator} ${string-abc}
If I am using the correct library?
*** Settings ***
Library AppiumLibrary run_on_failure=AppiumLibrary.CapturePageScreenshot
Library Selenium2Library run_on_failure=AppiumLibrary.CapturePageScreenshot
*** Variables ***
${MsgEditor} //*[@class='android.widget.RelativeLayout' and @resource-id='com.test.abc.work.cac:id/editor']
*** Test Cases ***
Add item
Press Keys text_field q <--error browser not open
\\or
appiumlibrary.Input Text ${MsgEditor} update <== error Message: Cannot set the element to 'update'. Did you interact with the correct element?
更新了 Press Keys 仍然失败。错误:
KEYWORD Selenium2Library . Press Keys text_field, q
Documentation:
Simulates the user pressing key(s) to an element or on the active browser.
Start / End / Elapsed: 20201218 10:05:20.575 / 20201218 10:05:21.339 / 00:00:00.764
00:00:00.755KEYWORD AppiumLibrary . Capture Page Screenshot
10:05:20.575 TRACE Arguments: [ 'text_field' | 'q' ]
10:05:20.581 INFO Sending key(s) ('q',) to text_field element.
10:05:21.339 FAIL No browser is open.
10:05:21.339 DEBUG Traceback (most recent call last):
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\__init__.py", line 471, in run_keyword
return DynamicCore.run_keyword(self, name, args, kwargs)
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\robotlibcore.py", line 103, in run_keyword
return self.keywords[name](*args, **(kwargs or {}))
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\keywords\element.py", line 895, in press_keys
element = self.find_element(locator)
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\base\context.py", line 74, in find_element
return self.element_finder.find(locator, tag, True, required, parent)
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\locators\elementfinder.py", line 74, in find
parent=parent or self.driver)
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\base\context.py", line 32, in driver
return self.ctx.driver
File "c:\users\tester\pycharmprojects\androidtest\venv\lib\site-packages\SeleniumLibrary\__init__.py", line 547, in driver
raise NoOpenBrowser('No browser is open.')
输入文本失败。我在其他领域也有同样的 InputText 并且可以工作。我尝试使用该定位器点击不同的字段并且它有效。 该应用程序在该元素上有问题吗?但我可以在点击字段后手动按下键盘。
【问题讨论】:
标签: robotframework appium-android