Appium studio录制的代码在phthon里面运行不了

#1

Error
Traceback (most recent call last):
File “D:\software\Python\Python37\lib\unittest\case.py”, line 59, in testPartExecutor
yield
File “D:\software\Python\Python37\lib\unittest\case.py”, line 615, in run
testMethod()
File “C:\Users\16621\PycharmProjects\app_auto\testcase\test_111.py”, line 30, in test_1
self.driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, self.dc)
File “C:\Users\16621\PycharmProjects\app_auto\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 144, in init
proxy
File “C:\Users\16621\PycharmProjects\app_auto\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 157, in init
self.start_session(capabilities, browser_profile)
File “C:\Users\16621\PycharmProjects\app_auto\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 219, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, parameters)
File “C:\Users\16621\PycharmProjects\app_auto\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 321, in execute
self.error_handler.check_response(response)
File “C:\Users\16621\PycharmProjects\app_auto\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created (Call to lock device failed)
Stacktrace:
at java.util.concurrent.FutureTask.get (:-1)
at com.experitest.image.agent.appium.http.AppiumInitSessionCommandHandler.handle (AppiumInitSessionCommandHandler.java:120)
at org.restlet.routing.Filter.doHandle (Filter.java:150)
at org.restlet.routing.Filter.handle (Filter.java:197)
at org.restlet.routing.Router.doHandle (Router.java:422)
at org.restlet.routing.Router.handle (Router.java:641)
at org.restlet.routing.Filter.doHandle (Filter.java:150)
at org.restlet.routing.Filter.handle (Filter.java:197)
at org.restlet.routing.Router.doHandle (Router.java:422)
at org.restlet.routing.Router.handle (Router.java:641)
at org.restlet.routing.Filter.doHandle (Filter.java:150)
at org.restlet.routing.Filter.handle (Filter.java:197)
at org.restlet.routing.Router.doHandle (Router.java:422)
at org.restlet.routing.Router.handle (Router.java:641)
at org.restlet.routing.Filter.doHandle (Filter.java:150)
at org.restlet.engine.application.StatusFilter.doHandle (StatusFilter.java:140)
at org.restlet.routing.Filter.handle (Filter.java:197)
at org.restlet.routing.Filter.doHandle (Filter.java:150)
at org.restlet.routing.Filter.handle (Filter.java:197)
at org.restlet.engine.CompositeHelper.handle (CompositeHelper.java:202)
at org.restlet.Component.handle (Component.java:408)
at org.restlet.Server.handle (Server.java:507)
at org.restlet.engine.connector.ServerHelper.handle (ServerHelper.java:63)
at org.restlet.engine.adapter.HttpServerHelper.handle (HttpServerHelper.java:143)
at org.restlet.engine.connector.HttpServerHelper$1.handle (HttpServerHelper.java:64)
at com.sun.net.httpserver.Filter$Chain.doFilter (:-1)
at sun.net.httpserver.AuthFilter.doFilter (:-1)
at com.sun.net.httpserver.Filter$Chain.doFilter (:-1)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle (:-1)
at com.sun.net.httpserver.Filter$Chain.doFilter (:-1)
at sun.net.httpserver.ServerImpl$Exchange.run (:-1)
at java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)
at java.lang.Thread.run (:-1)

Error
Traceback (most recent call last):
File “D:\software\Python\Python37\lib\unittest\case.py”, line 59, in testPartExecutor
yield
File “D:\software\Python\Python37\lib\unittest\case.py”, line 618, in run
self.tearDown()
File “C:\Users\16621\PycharmProjects\app_auto\testcase\test_111.py”, line 35, in tearDown
self.driver.quit()
AttributeError: ‘NoneType’ object has no attribute ‘quit’

Assertion failed
D:\software\Python\Python37\lib\unittest\case.py:643: ResourceWarning: unclosed <socket.socket fd=712, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=(‘127.0.0.1’, 55608), raddr=(‘127.0.0.1’, 4723)>
outcome.errors.clear()

0 Likes

#2

Have you exported the python code from AStudio and running code outside ? Have you checked if other language run is working ?

0 Likes