Веб-драйвер Microsoft Edge для селена генерирует сообщение WebDriverException Неизвестная ошибка в Python - PullRequest
0 голосов
/ 01 ноября 2018

В Win10 сборка 16299 и селен 3.14.1, следующий код (@@@@ = ​​отредактировано)

from selenium import webdriver
dir = '/Users/@@@@/AppData/Local/Continuum/anaconda3/Library/bin' 
edge_driver_bin = 'MicrosoftWebDriver.exe' 
edge_file = f'{dir}/{edge_driver_bin}' 
driver = webdriver.Edge(edge_file)

Открывает Edge с пустой страницей и выдает следующее исключение:

    WebDriverException                        Traceback (most recent call last)
<ipython-input-2-106cfded919a> in <module>
      6 edge_file = f'{dir}/{edge_driver_bin}'
      7 print(edge_file)
----> 8 driver = webdriver.Edge()

~\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\edge\webdriver.py in __init__(self, executable_path, capabilities, port, verbose, service_log_path, log_path, keep_alive)
     64                                               resolve_ip=False,
     65                                               keep_alive=keep_alive),
---> 66             desired_capabilities=capabilities)
     67         self._is_remote = False
     68 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector, options)
    155             warnings.warn("Please use FirefoxOptions to set browser profile",
    156                           DeprecationWarning, stacklevel=2)
--> 157         self.start_session(capabilities, browser_profile)
    158         self._switch_to = SwitchTo(self)
    159         self._mobile = Mobile(self)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in start_session(self, capabilities, browser_profile)
    250         parameters = {"capabilities": w3c_caps,
    251                       "desiredCapabilities": capabilities}
--> 252         response = self.execute(Command.NEW_SESSION, parameters)
    253         if 'sessionId' not in response:
    254             response = response['value']

~\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py in execute(self, driver_command, params)
    319         response = self.command_executor.execute(driver_command, params)
    320         if response:
--> 321             self.error_handler.check_response(response)
    322             response['value'] = self._unwrap_value(
    323                 response.get('value', None))

~\AppData\Local\Continuum\anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py in check_response(self, response)
    206             if exception_class == ErrorInResponseException:
    207                 raise exception_class(response, value)
--> 208             raise exception_class(value)
    209         if message == "" and 'message' in value:
    210             message = value['message']

WebDriverException: Message: Unknown error

Код edge_file был добавлен из-за связанной публикации переполнения стека, но это не имеет значения. Веб-драйвер находится в пути.

Код работает в Chrome; Я хотел использовать Edge, чтобы отделить среду тестирования от среды программирования. Он работает в Jupyter с Chrome и REPL.

Это не должно иметь никакого значения, но код для Edge работает в Jupyter.

Модального диалогового окна нет. (также упоминается в отдельной публикации переполнения стека)

...