selenium server无法启动浏览器
from selenium.webdriver import Remote import time driver = Remote(command_executor = 'http://127.0.0.1:4444/wd/hub', desired_capabilities = {"browserName": "chrome", "version": "", "platform": "ANY", "javascriptEnabled": True, } ) driver.get('http://www.baidu.com') driver.find_element_by_id('kw').send_keys('xxx') driver.find_element_by_id('su').click() time.sleep(2) driver.quit()
报错信息如下:
Traceback (most recent call last): File "C:\Users\Administrator\Desktop\Python\rrts.py", line 9, in <module> "javascriptEnabled": True, File "D:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 90, in __init__ self.start_session(desired_capabilities, browser_profile) File "D:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 177, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "D:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute self.error_handler.check_response(response) File "D:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=chrome, javascriptEnabled=true, version=, platform=ANY}] Stacktrace: at org.openqa.grid.web.servlet.handler.RequestHandler.process (RequestHandler.java:115) 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:808)