Front end developers must read! Starting from scratch, teach you to build a low code website platform in stages>>>
After colleagues of the company have learned about the newly installed automation environment, an error occurred while running the multi process test case:
multiprocessing.pool.MaybeEncodingError: Error sending result: ’< appium.webdriver.webdriver.WebDriver (session=“261019ae-3776-4a78-aa2c-b24bb64ec62e”)>’. Reason: ’AttributeError(“Can’t pickle local object ‘PoolManager.__ init__.& lt; locals>.& lt; lambda>‘“)’
I don’t have the same code here
There are three ways to search on the Internet
1. Replace process with thread
2. Copy can be used_ Reg to avoid the above exception.
3. Dill or paths. Multiprocessing: use ‘import paths. Multiprocessing’, instead of ‘import multiprocessing’. Paths. Multiprocessing is a fork of multiprocessing that uses dill. Dill can serialize almost anything in Python, so you are able to send a lot more around in parallel. 3
At the beginning, method 3 is used: use ‘import paths. Multiprocessing’, instead of ‘import multiprocessing’, and then the program does not throw the error, but after starting the case, appium does not work after starting the driver (using two processes to start the driver on different ports), and appium log has no error, Pychar has also been stuck there and does not execute find element, so it is still restored to using Import multiprocessing
The final solution is as follows:
1. Delete all the python in MAC
2. Install python with pyenv 3.5.2
3. Execute multi process case script
4. Install selenium, pilot and requests of the installation
5. The last step is to demote appium Python client: PIP install appium Python client = = 0.25 (this is the important point, you can directly demote the version by ignoring other steps, here is to re install it because you need to, Of course, the 0.31 version of local is OK, that is, there is a problem with the latest version (0.43)
6. Success