1

Due to presence of a sticky chat button, I can not click a button on screen on my Appium test. Can anyone help?

Code

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) doesn't work as shown in the picture due to a sticky online chat sticky button shown on the bottom right of the screen

enter image description here

Logs:

info: --> POST /wd/hub/session/7ee1afc3-9a7c-4105-b8e9-acdbf9570f46/elements {"using":"id","value":"com.servicemarket.app.debug:id/btnViewBooking"} info: [debug] Waiting up to 0ms for condition info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.servicemarket.app.debug:id/btnViewBooking","context":"","multiple":true}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.servicemarket.app.debug:id/btnViewBooking","context":"","multiple":true}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: find info: [debug] [BOOTSTRAP] [debug] Finding com.servicemarket.app.debug:id/btnViewBooking using ID with the contextId: multiple: true info: [debug] [BOOTSTRAP] [debug] Using: 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[] is 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[] is null: (1) info: [debug] [BOOTSTRAP] [debug] getElements tmp selector:UiSelector[INSTANCE=1, RESOURCE_ID=com.servicemarket.app.debug:id/btnViewBooking] info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":[{"ELEMENT":"126"}],"status":0} info: [debug] Responding to client with success: {"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"} info: --> POST /wd/hub/session/7ee1afc3-9a7c-4105-b8e9-acdbf9570f46/element/126/click {"id":"126"} info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"126"}] info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"126"}} info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION info: [debug] [BOOTSTRAP] [debug] Got command action: click info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0} info: [debug] Responding to client with success: {"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"}

ZIA ANSARI
  • 131
  • 1
  • 11
Mohsin Awan
  • 1,176
  • 2
  • 12
  • 29

1 Answers1

1

So you can get element. Thats already good. Try to click with TouchAction, e.g. press or longPress:

Point point = btnViewBooking.getLocation();
new TouchAction(driver)
    .longPress(point.getX(), point.getY())
    .release()
    .perform();
dmle
  • 3,498
  • 1
  • 14
  • 22
  • Are you able to use Appium Inspector (part of Appium Desktop - https://github.com/appium/appium-desktop). You can record a click action in there. It'll likely use xpath, but that may give you a clue about a visibility or layering issue. – Mike Collins Dec 23 '17 at 18:22