4

I am writing automation test for my ReactNative app with Appium. I'm unable to access react native components in appium. Even Appium inspector can't inspect inside react native view.

I'm trying something like this :

it("Testing Automation", function () {
return driver
   .waitForElementById('LogoutButton', 5000).click()
});

Is there anyway to know react native component's Xpath or anyway to access them by any other attribute? Thanks

Abhishek
  • 1,694
  • 2
  • 16
  • 27
  • 1
    Mostly you can try and access them as `WebView` elements. Could you try and inspect the elements using **chrome://inspect/#devices**. You can find there class, css, xpath etc as assigned while development. – Naman Jun 02 '16 at 07:11
  • 1
    Oh! i didn't knew about this inspector. Thank you. – Abhishek Jun 02 '16 at 07:22
  • good if it helps : – Naman Jun 02 '16 at 07:37
  • Unfortunately its doesn't inspect react-native app or I'm doing something wrong. – Abhishek Jun 02 '16 at 07:45
  • I'd be very surprised if it did as react-native doesn't run in a Webview. Have you tried using the Appium inspector included with the desktop app. Looking at my own app, it definitely behaves different to a native app (e.g. table rows appearing as single UI element) – Nick Jones Jul 01 '16 at 16:32
  • yes this didn't worked. Then I used Appium inspector and that worked, for some element i used "accessibilityLabel" (_its called accessibilityId in appium_) – Abhishek Jul 04 '16 at 07:55

1 Answers1

3

For the elements from react-native using chrome://inspect/#devices on your Chrome browser could provide you help inspect the elements similar to any other Webview.

You can find there class, css, x-path etc as assigned to them during development.

Naman
  • 27,789
  • 26
  • 218
  • 353