Session Expired error on GPS location Screen

Facing Session Expired error in the GPS location Screen even though I have already applied the wait command there. Also have applied the capabilities and increased the timeout of the appium server.
Thread. sleep(5000)
dc.setCapability(“newCommandTimeout”, 180);

How to handle it?

@jay_gandhi Check if the issue is related to network connectivity: Sometimes, this error can occur due to a network issue, so make sure that your device is connected to a stable network.

@Iniyavans, the Device is connected to the Stable Network. I have restarted the Appium server and also increase the time but still facing a session expired issue.

@jay_gandhi Can you please share the Appium server log?

Sure! Here it is @Iniyavans

LogFile.txt (402.8 KB)

let me check @jay_gandhi

1 Like

What is it? OS? Is this custom screen or system?
Show your code…

Hey @Oleg_Guzenko
It is a location screen through which we can get latitude & longitude.

@jay_gandhi you getting a NoSuchElementError error? Kindly share your code here please

@Iniyavans
Here it is. Code.txt (9.0 KB)
Hope you can help.

In your BaseClass, in the @BeforeClass you have:

// Set up the network interception using Charles Proxy
driver.setConnection(new ConnectionStateBuilder().withWiFiEnabled().build());

Since the error seems to be network related, this is where I’d start. What happens if you stop proxying the network?

@wreed
I have committed Charles Proxy still Facing the same session expired error.

Log.txt (253.9 KB)

Appium Server log file

Looks like it worked, no more ‘session expired’ message. Now just figure out the right identifier for the element.

Don’t know why I am still facing Session Expired Error. @wreed

@jay_gandhi could you post the new log with that error? The last one you posted does not have that error.

Error in current log is ‘NoSuchElementError’:

[debug] e[35m[WD Proxy]e[39m Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/2b53bed3-016b-45fd-ac2b-08e9e54249be/element] with body: {“strategy”:“xpath”,“selector”:“//android.widget.EditText[@index=‘1’] “,“context”:””,“multiple”:false}
[info] e[35m[WD Proxy]e[39m Got response with status 404: {“sessionId”:“2b53bed3-016b-45fd-ac2b-08e9e54249be”,“value”:{“error”:“no such element”,“message”:“An element could not be located on the page using the given search parameters”,“stacktrace”:"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.findElement(FindElement.java:90)\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:67)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:59)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:266)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:260)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerCont…
[debug] e[35m[W3C]e[39m Matched W3C error code ‘no such element’ to NoSuchElementError

My feeling is that if you are able to correctly identify this element you will be good to go.