如何解决此错误?
Yml文件:
version: "3.3"
services:
selenium-hub:
image: selenium/hub
ports:
- 4444:4444
chrome:
image: selenium/node-chrome
links:
- selenium-hub:hub
environment:
HUB_HOST: hub
volumes:
- /dev/shm:/dev/shm
firefox:
image: selenium/node-firefox
environment:
HUB_PORT_4444_TCP_ADDR: hub
links:
- selenium-hub:hub
Python脚本:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import string
from random import *
import time
import datetime
import itertools
from selenium.webdriver.common.desired_capabilities import
DesiredCapabilities
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('disable-gpu')
options.add_argument('window-size=1200,1100')
driverUser =
webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',desired
_capabilities={'browserName': 'chrome','version':'latest',
'javascriptEnabled': True})
错误消息:
回溯(最近通话最近):
中的文件“ tests.py”,第49行driverUser = webdriver.Remote(command_executor ='http://127.0.0.1:4444/wd/hub',desired_capabilities = {'browserName':'chrome','version':'69 .0','javascriptEnabled':True})
引发exception_class(消息,屏幕,堆栈跟踪) selenium.common.exceptions.WebDriverException:消息:找不到新会话时转发错误:功能{browserName:chrome,javascriptEnabled:true,版本:69.0}
Stacktrace: 在org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:118) 在org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:86) 在org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:70) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 在org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860) 在org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143) 在org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548) 在org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) 在org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) 在org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) 在org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473) 在org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) 在org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155) 在org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141) 在org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) 在org.seleniumhq.jetty9.server.Server.handle(Server.java:530) 在org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347) 在org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256) 在org.seleniumhq.jetty9.io.AbstractConnection $ ReadCallback.succeeded(AbstractConnection.java:279) 在org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102) 在org.seleniumhq.jetty9.io.ChannelEndPoint $ 2.run(ChannelEndPoint.java:124) 在org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) 在org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) 在org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) 在org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor $ ReservedThread.run(ReservedThreadExecutor.java:382) 在org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) 在org.seleniumhq.jetty9.util.thread.QueuedThreadPool $ 2.run(QueuedThreadPool.java:626) 在java.lang.Thread.run(Thread.java:748)