0

[Solution found, see below]

I am working with the following Python script (using Python 2.7) to open Microsoft Edge and browse to www.freelancer.in (using Selenium 3.8.1):

import os
from selenium import webdriver

# create new Edge session
dir = os.path.dirname(__file__)
edge_path = dir + "\MicrosoftWebDriver.exe"
driver = webdriver.Edge(edge_path)
driver.implicitly_wait(10)

driver.get("https://www.freelancer.in/")

It works properly on my local machine: Windows Pro Version 1709, OS 16299.125. However, it does not work on my virtual machine... I can't figure out why because I have the exact same Windows 10 Pro installed, I am using the same Microsoft Webdriver.exe (16299.15). The Microsoft WebDriver.exe seems to be working since it says:

[15:32:45.548] - Listening on http://localhost:17556/

But after, I receive the following error:

Traceback (most recent call last):
  File "C:\Users\program.py", line 9, in <module>
    driver = webdriver.Edge(edge_path)
  File "C:\Python27\lib\site-packages\selenium\webdriver\edge\webdriver.py", line 43, in __init__
    desired_capabilities=capabilities)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
    raise exception_class(value)
WebDriverException: Message: Unknown error

I didn't find any specific config to do in Microsoft Edge. Any ideas of what could be responsible for this error?

=> Solution found there : selenium.common.exceptions.WebDriverException: Message: Unknown error while trying to use Edge and MicrosoftWebDriver.exe through Selenium It was not working on the virtual machine because the User Account Control settings were Turned off... Turned on UAC resolved the issue.

Antoine M.
  • 11
  • 1
  • 4
  • Have you tried with other browsers? Is edge required? – SuperStew Jan 11 '18 at 15:02
  • Hi, my goal is to automatically test application on all possible web browser, i am using Robot Framework and its Selenium Library, I have no problem with the other browsers, it only does not work with edge. I wrote this script in python to see the problem was linked to robot framework (and it looks like it is not). – Antoine M. Jan 11 '18 at 15:13

3 Answers3

1

=> Solution found there : selenium.common.exceptions.WebDriverException: Message: Unknown error while trying to use Edge and MicrosoftWebDriver.exe through Selenium It was not working on the virtual machine because the User Account Control settings were Turned off... Turned on UAC resolved the issue.

Antoine M.
  • 11
  • 1
  • 4
0

The error says it all :

selenium.common.exceptions.WebDriverException: Message: Unknown error

It's pretty clear that the webdriver instance is not getting invoked. So you have to pass the edge_path along with the argument executable_path as follows :

driver = webdriver.Chrome(executable_path=edge_path)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Hi thanks for your answer. I just tried your way but I am still getting the same error message :/ Well, only the last line is different, I know have "WebDriverException: Message: Unknown error" instead – Antoine M. Jan 11 '18 at 15:13
  • Can you update the question with the latest error stack trace for further analysis? – undetected Selenium Jan 18 '18 at 20:30
0

I got identical issue with Edge. There should not be any specific configuration required for invoking Edge browser. Following code should be enough for opening it:

from selenium.webdriver import Edge
driver = Edge()

This works ok for me on laptop as in your case - but not on virtual machine with Win10... so I guess we got a possible pattern here.

You wrote you tried it with Microsoft Webdriver.exe 16299.15. You can try also newer version 17134 from microsoft. It did not work for me but could for you.

Also there is supposed to be possible to get Microsoft Webdriver.exe directly from your Win10 installation: Settings → Apps → Manage optional features → Add a feature → Microsoft WebDriver. This should install Microsoft Webdriver directly to your machine plus add it to PATH.

Btw... edge_path is not needed to pass if you got MicrosoftWebDriver.exe set in PATH.

krupaluke
  • 39
  • 7