appium/appium-inspector

Unable to connect session - Getting 'call to 'getpagesource' failed cannot read property 'client' of null'

gowsalya-murugan-zoomrx opened this issue · 14 comments

Is this an issue specifically with Appium Inspector?

  • I have verified that my issue does not occur with Appium, and should be investigated as an Appium Inspector issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am trying to connect and inspect app from emulator (sauce labs). On clicking 'Start session', the page is loading for sometime. As soon as its got redirected to the next page, 'call to 'getpagesource' failed cannot read property 'client' of null' error is thrown.
Screenshot 2023-08-15 at 9 24 54 PM

NOTE: I have verified the appium setup by appium-doctor. All the pre-requisites have been verified.

Appium server - v2.0.1
java version "1.8.0_202"
Appium inspector - app version 2023.8.1

Capabilities used - {
"platformName": "iOS",
"appium:platformVersion": "15.7",
"appium:deviceName": "iPhone 13 Pro",
"appium:udid": "9D91A1A5-6284-4083-B186-4DA32ADA9206",
"appium:automationName": "XCUITest",
"appium:app": "storage:filename=IOSAutomationforSandBox_19_06_23.ipa"
}

Expected Behavior

Should be able to connect without any error/interruption

Operating System

Mac

Appium Inspector Version

2023.8.1

Appium Version

2.0.1

Further Information

Error trace :
Unexpected Error: Cannot read property 'client' of null
Please report this issue at: https://github.com/appium/appium-inspector/issues/new/choose
Full error trace:
TypeError: Cannot read property 'client' of null
at g (file:///private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium%20Inspector.app/Contents/Resources/app.asar/dist/renderer.e31bb0bc.js:138:591)
at y (file:///private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium%20Inspector.app/Contents/Resources/app.asar/dist/renderer.e31bb0bc.js:138:1421)
at renderWithHooks (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:16305:18)
at mountIndeterminateComponent (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:20074:13)
at beginWork (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:21587:16)
at beginWork$1 (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:27426:14)
at performUnitOfWork (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:26560:12)
at workLoopSync (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:26466:5)
at renderRootSync (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:26434:7)
at recoverFromConcurrentError (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:25850:20)
at performSyncWorkOnRoot (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:26096:20)
at flushSyncCallbacks (/private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:12042:22)
at /private/var/folders/xb/gt7h8x811zbd752gy2ll6h_40000gn/T/AppTranslocation/B79F94BC-A504-4D3C-9C13-52754CD866B0/d/Appium Inspector.app/Contents/Resources/app.asar/node_modules/react-dom/cjs/react-dom.development.js:25651:13

The problem is actually described by the first error in the screenshot - the Inspector is unable to connect to the Sauce Labs Appium server with your session details. Please make sure you have entered all the Sauce Labs server details and credentials correctly.
However, the fact that this next screen was opened is indeed a bug, which has been fixed in #1030 and will be included in the next release.

Out of curiosity, can you also try with Inspector version 2023.7.1?

In v2023.7.1, I am not getting 'getPageSource null' error. Its not even redirected to the session's page. But I am still getting the 'Could not connect to server' error.

Regaring the other issue I am encountering,
Sauce labs credentials are correct and I am even running appium server with enabled --allow-cors. I know it is not the problem we are now discussing about. But still, I wanted to know the reason for it. I have been facing this problem for the past 1 month. I tried re-installing all the software related to appium from the scratch. I am not even getting any logs in appium-server. I really don't know how to resolve this. If you could help, It would be super easy for me.
Thanks.

Are you able to connect to the Sauce Labs emulator through your automation code? That is, using only your Appium client, not Appium Inspector.
If yes, can you please share the Appium logs for that session? (but please redact any sensitive info like your Sauce credentials)
If no, then the Inspector is not the cause of the issue. If you're sure your credentials are correct, then it might be a problem on the Sauce Labs side. Remember that you are connecting to an Appium server running on the Sauce Labs server, not your local machine.

I am able to connect to Sauce labs through automation code. Hereby attaching the appium logs. Please do the needful.
appium_logs.pdf

Thanks. Is it possible to get the logs in a more readable, raw text format? It's quite hard to read them when every line is wrapped in 5 additional lines of JSON.
@jlipps do you perhaps know if this log looks okay for connecting to Sauce Labs? I'm a bit confused about the username and accessKey parameters not being recognised (among others). But maybe they are parsed from elsewhere, not from the capabilities.

Hereby attaching the logs in .log format.
appium.log

@eglitise Is there any update on this?

Could you please try with the newly released 2023.8.2? I don't think it will fully fix your issue, but at the very least it should behave closer to 2023.7.1 where the page is not being redirected.
And could you then post a screenshot of your Sauce Labs connection details inside the Inspector? I'm wondering if the data sent from the inspector may be different from the data sent from your automation code.

@eglitise I have upgraded the version to 2023.8.2 where it is not being redirected to session if the session creation fails.
Regarding the other issue, I have attached the Screenshot. Data sent from automation code is same as the one I have used in inspector. In automation code, username and accesskey are sent as capabilities. Here it is provided globally. I have also tried sending them as capabilities. But it didn't work.

Screenshot 2023-08-18 at 10 53 31 AM

I checked your Appium log - are you only sending the username and accessKey as part of capabilities, and nowhere else? I looked at the Sauce Labs documentation, and if you want to pass the username/key as capabilities, they must be placed inside the sauce:options structure. See their provided example snippets.
If you retrieved the log from Sauce Labs, then I suppose the connection did work, and you had likely also set your credentials as server options or part of the Sauce Labs URL.

I checked your Appium log - are you only sending the username and accessKey as part of capabilities, and nowhere else? I looked at the Sauce Labs documentation, and if you want to pass the username/key as capabilities, they must be placed inside the sauce:options structure. See their provided example snippets. If you retrieved the log from Sauce Labs, then I suppose the connection did work, and you had likely also set your credentials as server options or part of the Sauce Labs URL.

why should i config “Sauce Lab”, i use the appium server. you just promote the sauce lab

@yonghuifan21 please leave comments under your existing issue #1050 if you are still having problems. This specific issue is likely not related to your problem.

Closing due to no response