selenium server运行报错

使用的环境:python3.6.1,selenium3.4.3
启动的服务:selenium-server-standalone-3.4.0.jar

正常启动服务后运行脚本,提示错误如下:


selenium.common.exceptions.WebDriverException: Message: None
Stacktrace:
    at java.util.HashMap.putMapEntries (HashMap.java:500)
    at java.util.HashMap.putAll (HashMap.java:784)
    at org.openqa.selenium.remote.DesiredCapabilities. (DesiredCapabilities.java:55)
    at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:104)
    at org.openqa.grid.web.servlet.DriverServlet.process (DriverServlet.java:83)
    at org.openqa.grid.web.servlet.DriverServlet.doPost (DriverServlet.java:67)
    at javax.servlet.http.HttpServlet.service (HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service (HttpServlet.java:790)
    at org.seleniumhq.jetty9.servlet.ServletHolder.handle (ServletHolder.java:841)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle (ServletHandler.java:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle (SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle (ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle (ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope (ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope (SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope (ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope (ContextHandler.java:1130)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle (ScopedHandler.java:141)
    at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle (HandlerWrapper.java:132)
    at org.seleniumhq.jetty9.server.Server.handle (Server.java:564)
    at org.seleniumhq.jetty9.server.HttpChannel.handle (HttpChannel.java:320)
    at org.seleniumhq.jetty9.server.HttpConnection.onFillable (HttpConnection.java:251)
    at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded (AbstractConnection.java:279)
    at org.seleniumhq.jetty9.io.FillInterest.fillable (FillInterest.java:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run (ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred (Invocable.java:122)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke (ExecutingExecutionStrategy.java:58)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume (ExecuteProduceConsume.java:201)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run (ExecuteProduceConsume.java:133)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob (QueuedThreadPool.java:672)
    at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run (QueuedThreadPool.java:590)
    at java.lang.Thread.run (Thread.java:745)
[Finished in 0.3s]

解决方法:
降级selenium

首先我把selenium降到3.0.0,问题解决
然后发现新问题,每次运行测试脚本后都会提示以下信息:

Exception ignored in: >
Traceback (most recent call last):
  File "D:\python3.6\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
  File "D:\python3.6\lib\site-packages\selenium\webdriver\common\service.py", line 139, in stop
  File "D:\python3.6\lib\site-packages\selenium\webdriver\common\service.py", line 110, in send_remote_shutdown_command
ImportError: sys.meta_path is None, Python is likely shutting down

最后使用:selenium3.3.1
启动的服务:selenium-server-standalone-3.4.0.jar
到此以上问题解决

你可能感兴趣的:(python,Selenium)