I'm trying to run behave
tests on Windows Edge in CircleCI, but even simple test fails initializing a session with
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
I use standard CircleCI windows image windows-server-2019-vs2019:stable
Install there Edge driver and try to start it as a service:
choco install -y jdk10 selenium-edge-driver selenium
Then I ssh to the machine for debugging and try
python -c "from selenium import webdriver; webdriver.Edge()"
This cause the error above. The path to the web-driver is correct, an incorrect causes another error.
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
Stating the server by myself:
/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))"
This results with a 401 error bad request or if I update desired_capabilities
something like:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found
Currently, there is no way to install Edge on the CircleCI image. But if services like BrowserStack doesn't suit you, there is a way to run Selenium with Windows/Edge on your own/AWS machine deploying an official Vagrant image.
webdriver.Remote
you can connect to the Selenium (hub or stand alone) with Edge and a web-driver for it installed.