Appium tests fail with Null pointer Exception

Running the tests on a real ios device:
[debug] [WebDriverAgent] Upgrade timestamp of the currently bundled WDA: 1585526795320
[debug] [WebDriverAgent] Upgrade timestamp of the WDA on the device: 1585526795320
[WebDriverAgent] Will reuse previously cached WDA instance at ‘http://127.0.0.1:8100/’ with ‘com.facebook.WebDriverAgentRunner’. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[debug] [XCUITest] Trying to start WebDriverAgent 1 times with 10000ms interval
[debug] [XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[debug] [BaseDriver] Event ‘wdaStartAttempted’ logged at 1585533369283 (21:56:09 GMT-0400 (Eastern Daylight Time))
[WebDriverAgent] Using provided WebdriverAgent at ‘port_number’
[debug] [WD Proxy] Matched ‘/status’ to command name ‘getStatus’
[debug] [WD Proxy] Proxying [GET /status] to [GET port_number/status] with no body
[debug] [WD Proxy] Got response with status 200: {
[debug] [WD Proxy] “value” : {
[debug] [WD Proxy] “message” : “WebDriverAgent is ready to accept commands”,
[debug] [WD Proxy] “state” : “success”,
[debug] [WD Proxy] “os” : {
[debug] [WD Proxy] “name” : “iOS”,
[debug] [WD Proxy] “version” : “11.4”,
[debug] [WD Proxy] “sdkVersion” : “13.0”
[debug] [WD Proxy] },
[debug] [WD Proxy] “ios” : {
[debug] [WD Proxy] “simulatorVersion” : “11.4”,
[debug] [WD Proxy] “ip” : “192.168.0.11”
[debug] [WD Proxy] },
[debug] [WD Proxy] “ready” : true,
[debug] [WD Proxy] “build” : {
[debug] [WD Proxy] “upgradedAt” : “1585526795320”,
[debug] [WD Proxy] “time” : “Mar 29 2020 21:47:34”,
[debug] [WD Proxy] “productBundleIdentifier” : “com.facebook.WebDriverAgentRunner”
[debug] [WD Proxy] }
[debug] [WD Proxy] },
[debug] [WD Proxy] “sessionId” : “8C661442-D1BD-4FA2-8B51-E87BB5B7F60B”
[debug] [WD Proxy] }
[debug] [BaseDriver] Event ‘wdaSessionAttempted’ logged at 1585533369298 (21:56:09 GMT-0400 (Eastern Daylight Time))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [WD Proxy] Matched ‘/session’ to command name ‘createSession’
[debug] [WD Proxy] Proxying [POST /session] to [POST port_number/session] with body: {“capabilities”:{“firstMatch”:[{“bundleId”:“com.apps.app1”,“arguments”:[],“environment”:{},“eventloopIdleDelaySec”:0,“shouldWaitForQuiescence”:true,“shouldUseTestManagerForVisibilityDetection”:false,“maxTypingFrequency”:60,“shouldUseSingletonTestManager”:true,“defaultAlertAction”:“accept”}],“alwaysMatch”:{}}}
[debug] [WD Proxy] Got response with status 200: {“value”:{“sessionId”:“4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”,“capabilities”:{“device”:“iphone”,“browserName”:“app1”,“sdkVersion”:“11.4”,“CFBundleIdentifier”:“com.apps.app1”}},“sessionId”:“4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”}
[WD Proxy] Determined the downstream protocol as ‘W3C’
[debug] [BaseDriver] Event ‘wdaSessionStarted’ logged at 1585533372273 (21:56:12 GMT-0400 (Eastern Daylight Time))
[debug] [BaseDriver] Event ‘wdaStarted’ logged at 1585533372273 (21:56:12 GMT-0400 (Eastern Daylight Time))
[XCUITest] Skipping setting of the initial display orientation. Set the “orientation” capability to either “LANDSCAPE” or “PORTRAIT”, if this is an undesired behavior.
[debug] [BaseDriver] Event ‘orientationSet’ logged at 1585533372274 (21:56:12 GMT-0400 (Eastern Daylight Time))
[debug] [BaseDriver] The value of ‘elementResponseAttributes’ setting did not change. Skipping the update for it
[debug] [BaseDriver] The value of ‘shouldUseCompactResponses’ setting did not change. Skipping the update for it
[Appium] New XCUITestDriver session created successfully, session 1f15b0a3-d211-4fff-bc3d-bea527b1bb15 added to master session list
[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1585533372277 (21:56:12 GMT-0400 (Eastern Daylight Time))
[debug] [W3C (1f15b0a3)] Cached the protocol value ‘W3C’ for the new session 1f15b0a3-d211-4fff-bc3d-bea527b1bb15
[debug] [W3C (1f15b0a3)] Responding to client with driver.createSession() result: {“capabilities”:{“webStorageEnabled”:false,“locationContextEnabled”:false,“browserName”:"",“platform”:“MAC”,“javascriptEnabled”:true,“databaseEnabled”:false,“takesScreenshot”:true,“networkConnectionEnabled”:false,“platformName”:“ios”,“app”:“com.apps.app1”,“autoAcceptAlerts”:true,“automationName”:“XCUITest”,“deviceName”:“Dummy”,“locationServicesEnabled”:true,“newCommandTimeout”:75,“platformVersion”:“11.4”,“showXcodeLog”:true,“udid”:“f9b3fd1a1c999f2f7c87d7d260237691e6a4c421”,“updatedWDABundleId”:“com.facebook.WebDriverAgentRunner”,“xcodeOrgId”:“XXXXXXXXXX”,“xcodeSigningId”:“iPhone Developer”}}
[HTTP] <-- POST /wd/hub/session 200 7175 ms - 671
[HTTP]
Mar 29, 2020 9:56:12 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
[HTTP] --> GET /wd/hub/session/1f15b0a3-d211-4fff-bc3d-bea527b1bb15
[HTTP] {}
[debug] [W3C (1f15b0a3)] Calling AppiumDriver.getSession() with args: [“1f15b0a3-d211-4fff-bc3d-bea527b1bb15”]
[debug] [XCUITest] Executing command ‘getSession’
[debug] [WD Proxy] Matched ‘/’ to command name ‘getSession’
[debug] [WD Proxy] Proxying [GET /] to [GET port_number/session/4FB056A2-9F59-40BA-89FC-5E3E3D5CF416] with no body
[debug] [WD Proxy] Got response with status 200: {
[debug] [WD Proxy] “value” : {
[debug] [WD Proxy] “sessionId” : “4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”,
[debug] [WD Proxy] “capabilities” : {
[debug] [WD Proxy] “device” : “iphone”,
[debug] [WD Proxy] “browserName” : “app1”,
[debug] [WD Proxy] “sdkVersion” : “11.4”,
[debug] [WD Proxy] “CFBundleIdentifier” : “com.apps.app1”
[debug] [WD Proxy] }
[debug] [WD Proxy] },
[debug] [WD Proxy] “sessionId” : “4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”
[debug] [WD Proxy] }
[debug] [WD Proxy] Proxying [GET /wda/screen] to [GET port_number/session/4FB056A2-9F59-40BA-89FC-5E3E3D5CF416/wda/screen] with no body
[debug] [WD Proxy] Got response with status 200: {
[debug] [WD Proxy] “value” : {
[debug] [WD Proxy] “statusBarSize” : {
[debug] [WD Proxy] “width” : 414,
[debug] [WD Proxy] “height” : 20
[debug] [WD Proxy] },
[debug] [WD Proxy] “scale” : 2
[debug] [WD Proxy] },
[debug] [WD Proxy] “sessionId” : “4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”
[debug] [WD Proxy] }
[debug] [WD Proxy] Proxying [GET /window/size] to [GET http://127.0.0.1:8100/session/4FB056A2-9F59-40BA-89FC-5E3E3D5CF416/window/size] with no body
[debug] [WD Proxy] Got response with status 200: {
[debug] [WD Proxy] “value” : {
[debug] [WD Proxy] “width” : 414,
[debug] [WD Proxy] “height” : 736
[debug] [WD Proxy] },
[debug] [WD Proxy] “sessionId” : “4FB056A2-9F59-40BA-89FC-5E3E3D5CF416”
[debug] [WD Proxy] }
[XCUITest] Merging WDA caps over Appium caps for session detail response
[debug] [W3C (1f15b0a3)] Responding to client with driver.getSession() result: {“udid”:“f9b3fd1a1c999f2f7c87d7d260237691e6a4c421”,“platformName”:“ios”,“app”:“com.apps.app1”,“autoAcceptAlerts”:true,“automationName”:“XCUITest”,“deviceName”:“Dummy”,“locationServicesEnabled”:true,“newCommandTimeout”:75,“platformVersion”:“11.4”,“showXcodeLog”:true,“updatedWDABundleId”:“com.facebook.WebDriverAgentRunner”,“xcodeOrgId”:“XXXXXXXXXX”,“xcodeSigningId”:“iPhone Developer”,“device”:“iphone”,“browserName”:“app1”,“sdkVersion”:“11.4”,“CFBundleIdentifier”:“com.apps.app1”,“pixelRatio”:2,“statBarHeight”:20,“viewportRect”:{“left”:0,“top”:40,“width”:828,“height”:1432}}
[HTTP] <-- GET /wd/hub/session/1f15b0a3-d211-4fff-bc3d-bea527b1bb15 200 288 ms - 614
[HTTP]
[HTTP] --> GET /wd/hub/session/1f15b0a3-d211-4fff-bc3d-bea527b1bb15
[HTTP] {}
[debug] [W3C (1f15b0a3)] Calling AppiumDriver.getSession() with args: [“1f15b0a3-d211-4fff-bc3d-bea527b1bb15”]
[debug] [XCUITest] Executing command ‘getSession’
[XCUITest] Merging WDA caps over Appium caps for session detail response
[debug] [W3C (1f15b0a3)] Responding to client with driver.getSession() result: {“udid”:“f9b3fd1a1c999f2f7c87d7d260237691e6a4c421”,“platformName”:“ios”,“app”:“com.apps.app1”,“autoAcceptAlerts”:true,“automationName”:“XCUITest”,“deviceName”:“Dummy”,“locationServicesEnabled”:true,“newCommandTimeout”:75,“platformVersion”:“11.4”,“showXcodeLog”:true,“updatedWDABundleId”:“com.facebook.WebDriverAgentRunner”,“xcodeOrgId”:“XXXXXXXXXX”,“xcodeSigningId”:“iPhone Developer”,“device”:“iphone”,“browserName”:“app1”,“sdkVersion”:“11.4”,“CFBundleIdentifier”:“com.apps.app1”,“pixelRatio”:2,“statBarHeight”:20,“viewportRect”:{“left”:0,“top”:40,“width”:828,“height”:1432}}
[HTTP] <-- GET /wd/hub/session/1f15b0a3-d211-4fff-bc3d-bea527b1bb15 200 1 ms - 614
[HTTP]

java.lang.NullPointerException
at com.apps.app1.app1Test.verifyForgotPasswordTest(app1Test.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:584)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)