由于存在粘性聊天按钮,我无法在Appium测试中点击屏幕上的按钮。有人可以帮忙吗?
代码
public static void TapViewBookingButton() throws InterruptedException
{
Setup.startTimer();
MobileElement btnViewBooking = (MobileElement) Setup.wait.until(ExpectedConditions.presenceOfElementLocated(By.id(btnViewBooking_ID)));
btnViewBooking.click();
Setup.updateLogMessage("VIEW BOOKING button clicked in " + Setup.stopTimer(Setup.stopWatch), SM_CONSTANTS.isScreenshot);
}
buttonViewBooking.Click() - (VIEW BOOKING)无法正常工作,因为屏幕右下方显示粘性在线聊天粘滞按钮
日志:
info: - > POST / wd / hub / session / 7ee1afc3-9a7c-4105-b8e9-acdbf9570f46 / elements {“using”:“id”,“value”:“com.servicemarket.app.debug:id / btnViewBooking”} info:[debug]条件最多等待0ms info:[debug]将命令推送到appium工作队列:[“find”,{“strategy”:“id”,“selector”:“com.servicemarket.app.debug:id / btnViewBooking”,“context”:“” , “多”:真正}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”: “com.servicemarket.app.debug:ID / btnViewBooking”, “语境”: “”, “多”:真正}} info:[debug] [BOOTSTRAP] [debug]得到ACTION类型的命令 info:[debug] [BOOTSTRAP] [debug]得到命令动作:find info:[debug] [BOOTSTRAP] [debug]使用带有contextId的ID查找com.servicemarket.app.debug:id / btnViewBooking:multiple:true info:[debug] [BOOTSTRAP] [debug]使用:UiSelector [RESOURCE_ID = com.servicemarket.app.debug:id / btnViewBooking] info:[debug] [BOOTSTRAP] [debug] getElements selector:UiSelector [RESOURCE_ID = com.servicemarket.app.debug:id / btnViewBooking] info:[debug] [BOOTSTRAP] [debug] Element []为null:(0) info:[debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector [INSTANCE = 0,RESOURCE_ID = com.servicemarket.app.debug:id / btnViewBooking] info:[debug] [BOOTSTRAP] [debug] Element []为null:(1) info:[debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector [INSTANCE = 1,RESOURCE_ID = com.servicemarket.app.debug:id / btnViewBooking] info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:[{“ELEMENT”:“126”}],“status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:[{“ELEMENT”:“126”}],“sessionId”:“7ee1afc3-9a7c-4105-b8e9-acdbf9570f46”} info:< - POST / wd / hub / session / 7ee1afc3-9a7c-4105-b8e9-acdbf9570f46 / elements 200 36.010 ms - 91 {“status”:0,“value”:[{“ELEMENT”:“126” }], “的sessionId”: “7ee1afc3-9a7c-4105-b8e9-acdbf9570f46”} 信息: - > POST / wd / hub / session / 7ee1afc3-9a7c-4105-b8e9-acdbf9570f46 / element / 126 / click {“id”:“126”} info:[debug]将命令推送到appium工作队列:[“element:click”,{“elementId”:“126”}] info:[debug] [BOOTSTRAP] [debug]从客户端获取数据:{“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“126”}} info:[debug] [BOOTSTRAP] [debug]得到ACTION类型的命令 info:[debug] [BOOTSTRAP] [debug]得到命令动作:点击 info:[debug] [BOOTSTRAP] [debug]返回结果:{“value”:true,“status”:0} info:[debug]成功响应客户端:{“status”:0,“value”:true,“sessionId”:“7ee1afc3-9a7c-4105-b8e9-acdbf9570f46”} info:< - POST / wd / hub / session / 7ee1afc3-9a7c-4105-b8e9-acdbf9570f46 / element / 126 / click 200 306.260 ms - 76 {“status”:0,“value”:true,“sessionId” : “7ee1afc3-9a7c-4105-b8e9-acdbf9570f46”}
答案 0 :(得分:1)
所以你可以获得元素。多数民众赞成已经很好尝试点击TouchAction
,例如press
或longPress
:
Point point = btnViewBooking.getLocation();
new TouchAction(driver)
.longPress(point.getX(), point.getY())
.release()
.perform();