Home > Mobile >  Unable to identify Button in hybrid page in android app appium
Unable to identify Button in hybrid page in android app appium

Time:02-11

I have tried to identify 'Send' button but Appium doesn't shown source of that page. This page is a webpage in hybrid android app. Is there any way to get source of this button and verify/inspect it?

I have tried with chrome://inspect/#devices and able to inspect this button in Developer tools but don't know where verify? This is what DOM has inspected.

<button id="btnSaveForm" type="button" ng-click="submitForm(1)" ng-disabled="isXhrPending() || mainCtrl.isAttachUploading">Send</button>

What could be the Xpath of this and how do I verify it?

enter image description here

CodePudding user response:

You can use either of the following based locator strategies:

  • Using XPATH 1:

    //button[@class='btn btn-danger' and @id='btnSaveForm'][text()='Send']
    
  • Using XPATH 2:

    //button[@class='btn btn-danger' and @id='btnSaveForm'][starts-with(@ng-click, 'submitForm') and text()='Send']
    

CodePudding user response:

When dealing with dynamic rendering you should try to keep your xpath as simple as possible.

How about selecting by buttons function: //button[contains(@ng-click,"submitForm")]?

  • Related