A little help trying to set text on a react native TextInput

Hello,

I’m trying to set text on a react-native TextInput but everytime Appium gives me a null object reference.

The react-native component:

My tests are in nightwatch js: browser.elementIdValue(‘Email’, ‘test’);

Appium server log:

[HTTP] → POST /wd/hub/session/71a7fab0-09dc-4a0b-9ad9-9965cc904e60/element/Ema
il/value {“value”:[“t”,“e”,“s”,“t”]}
[debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [[“t”,“e”,“s”,“t”],
“Email”,“71a7fab0-09dc-4a0b-9ad9-9965cc904e60”]
[debug] [AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:
“element:setText”,“params”:{“elementId”:“Email”,“text”:“test”,“replace”:false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”
,“action”:“element:setText”,“params”:{“elementId”:“Email”,“text”:“test”,"replace
":false}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: setText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Command returned error:java.lang.Null
PointerException: Attempt to invoke virtual method ‘java.lang.String io.appium.a
ndroid.bootstrap.AndroidElement.getId()’ on a null object reference
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:13,"value
":“Attempt to invoke virtual method ‘java.lang.String io.appium.android.bootstra
p.AndroidElement.getId()’ on a null object reference”}
[debug] [AndroidBootstrap] Received command result from bootstrap
[HTTP] ← POST /wd/hub/session/71a7fab0-09dc-4a0b-9ad9-9965cc904e60/element/Ema
il/value 500 13 ms - 154

I was thinking that maybe appium could not be finding the element ID but then why would this command: browser…expect.element(‘Email’, ‘id’).to.be.present; works 100%?

Thank you for the help.

Assuming that u are trying to input something into your inputBox, my 2 cents:

  1. Use uiautomator (and take a snapshot of screen containg the input box)
  2. Now u can find xpath of your inputbox
    In my case, this is what helped me
    browser.elementByXPath(<your inputBox’s xpath>).type(‘some text’)
    BTW, M using nodejs . Make suitable changes for ur case