error.log (848.6 KB)
native切换webview后,
chrome://inspect/#devices能查看页面元素,脚本也能获取元素,但是click操作不报错,但是不起作用,
TouchAction(self.Action).tap(el).perform()方法,操作后报错,
获取到session了,如下:
{“value”:{“element-6066-11e4-a52e-4f735466cecf”:“7a91d8e3-73fe-43d0-8a9a-6ecc530ff233”}}
7a91d8e3-73fe-43d0-8a9a-6ecc530ff233
执行:TouchAction(self.Action).tap(el).perform()报错
[debug] [W3C (f8521aa4)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.ElementNotFoundException: The element identified by ‘7a91d8e3-73fe-43d0-8a9a-6ecc530ff233’ is not present in the cache or has expired. Try to find it again
代码:
@allure.story(‘首页进入商详’)
def test_homepage_goods_detail(self):
self.Action.switch_to.context(self.Action.contexts[1])
for window in self.Action.window_handles[1:]:
self.Action.switch_to.window(window)
if “首页” in self.Action.page_source:
self.Action.swip_up()
print(window)
# self.Action.find_element(self.分类tab).click()
print(“第一次”, self.Action.window_handles)
sleep(3)
self.Action.find_element(self.万人团).click()
el = self.Action.find_element(self.万人团)
TouchAction(self.Action).tap(el).perform()
希望知道的老师同学们多多指导,感谢