我正在尝试在CircleCI中的Windows Edge上运行behave
测试,但是即使是简单测试也无法通过
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\circleci\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\edge\webdriver.py", line 66, in __init__
desired_capabilities=capabilities)
File "C:\Users\circleci\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\circleci\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\circleci\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\circleci\AppData\Roaming\Python\Python36\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Unknown error
我使用标准的CircleCI Windows图像windows-server-2019-vs2019:stable
在此处安装Edge驱动程序,然后尝试将其作为服务启动:
choco install -y jdk10 selenium-edge-driver selenium
然后我将SSH送至计算机进行调试,然后尝试
python -c "from selenium import webdriver; webdriver.Edge()"
这将导致上述错误。 Web驱动程序的路径正确,不正确会导致另一个错误。
reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v PromptOnSecureDesktop /t REG_DWORD /d 0 /f
reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
独自管理服务器:
/c/tools/selenium/MicrosoftWebDriver.exe
[14:48:13.545] - Listening on http://localhost:17556/
python -c "from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver; from selenium.webdriver.common.desired_capabilities import DesiredCapabilities; from selenium.webdriver.chrome.remote_connection import ChromeRemoteConnection; rwd = RemoteWebDriver(command_executor=ChromeRemoteConnection(remote_server_addr='http://localhost:17556', keep_alive=False))"
这会导致401错误的错误请求,或者如果我更新desired_capabilities
诸如此类的结果:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found
答案 0 :(得分:0)
当前,尚无法在CircleCI映像上安装Edge。但是,如果BrowserStack之类的服务不适合您,则可以使用一种方法在自己的/ AWS计算机上使用Windows / Edge运行Selenium,以部署官方的Vagrant映像。
webdriver.Remote
,可以使用Edge和安装了它的Web驱动程序连接到Selenium(集线器或独立的)。