Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk Execution is throwing Appium WebDriveexception and StaleElementReferenceException #623

Open
soma-githubcloud opened this issue Aug 4, 2021 · 8 comments

Comments

@soma-githubcloud
Copy link

The Problem

(1)WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up
(2)StaleElementReferenceException: Message: androidx.test.uiautomator.StaleObjectException
(3)Test execution stopped due to a fatal error

Environment

Appium version : Appium 1.21.0
Desktop OS/version used to run Appium:
Node version : v14.3.0
Npm Version : 6.14.5
Mobile platform/version under test: Android 10 and 11 (Models - OPPO F7, MOTTO G6, SAMSUNG M31 , Goggle Pixel)
Real device or emulator/simulator: Real Devices
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
robotframework-appiumlibrary : 1.5.0.6
Appium-UIAutomation : 0.1.0
Appium-Python-Client : 1.0.2
robotframework : 3.2.2
robotframework-seleniumlibrary : 4.3.0
webdrivermanager : 0.8.0

Details

(1) product Overview : Telecom application which have functionality to work with SMS,CALLS and CONTACTS for business enterprises solution .
(2) Test running challenges :
(i)Product point of view we are using Robot framework using RIDE as IDE tool for Automating our test suite using Selenium and Appium Library.
(ii)While running more than 50+ scripts appium server stops the response and throw bad server error ,which leads to failures of rest scripts in the suite
(iii)Changing from default to any other port number also not worked out much (e.g; default from 4723 to 4725)
(iv)Also, we have some scenario where we have to do cross platform testing with (Web+Mobile).
(v)We are not only checking the cases within the application as we are doing touch base on Mobile Native application as well like - dealing with network connections to ON or off the wifi ,Data , etc
(vi) we are getting element not found several times where we can see the element is present in the screen, we have tried with all sync options and looks like it is the response from Appium server which Is causing the problem

@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented Aug 4, 2021

Please do not merge all issues into one report. It is very hard to parse huge logs.
Instead, try to isolate each of them and report it in isolation.

I did not check the details, but in general my observations regarding the above stuff are:

  • socket hang up means that the remote server running on the device stopped responding to Appium proxy. This might happen because of unexpected network issues or because of issues in the server itself. For example switching the state of WiFi or Data component might also cause such unexpected network disconnect. Also, it is necessary to make sure the parallel test execution itself is configured properly, so there are no conflicts between shared resources: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/parallel-tests.md
  • StaleElementReferenceException happens if you cache an element on the client side, although this element is not anymore available in the app. A solution/workaround to that would be usually to retry element lookup instead of using the cached instance of it. Sometimes it is also a race condition issue. In such case it makes sense to use explicit waits.
  • fatal error: too generic, nothing to say there without a more detailed description

@soma-githubcloud
Copy link
Author

Hi @mykola-mokhnach : thanks for your input.
We are trying the comments in our scripts context, will get back with the observations.

@soma-githubcloud
Copy link
Author

hi @mykola-mokhnach : We are handling Call scenario with our app where we are always connecting two devices,
We have used Robot Framework here and we are using robot framework appium library here.
There step where we are now getting the webdriver exception is -> Close All Applications.
The complete error - WebDriverException: Message: A session is either terminated or not started.
You are switching between 2 devices and finally in the tear down we are writing "Close All Applications"
I am attaching the python file which robot framework code is written for - "Close All Applications".
Please let me know if there is any driver conflict going on here ? as we are using two devices , two times we are launching applications . If so then how better we can handle that.

@soma-githubcloud
Copy link
Author

@mykola-mokhnach
Copy link
Contributor

Unfortunately I don't know much about that client wrapper, so cannot help much there.

@VenkateshPS
Copy link
Contributor

@soma-githubcloud do you have the stack trace of exception. You should try debugging self._cache.close_all()

@soma-githubcloud
Copy link
Author

@VenkateshPS : Venkatesh the stack trace is related to android log cat? where i should use debugging self._cache.close_all()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants