2017-10-17 72 views
1

我试图使用浏览边缘的URL。我已经下载了最新的Microsoft WebDriver并放置在Downloads文件夹中。序号找不到 - MicrosoftDriver.exe

我的代码:

import os 
from selenium import webdriver  
dir = "C:\Users\Local_Admin\Downloads" 
edge_path = dir + "\MicrosoftWebDriver.exe" 
driver = webdriver.Edge(edge_path) 
driver.implicitly_wait(10) 
driver.maximize_window() 
driver.get("https://www.freelancer.in/") 
driver.quit() 

我总是得到下面的控制台错误和弹出窗口说: “序号找不到 - MicrosoftDriver.exe”:

Traceback (most recent call last): 
File "test_edge.py", line 7, in <module> 
driver = webdriver.Edge(edge_path) 
File "C:\Python27\lib\site-packages\selenium-3.4.3-py2.7.egg\selenium\webdriver\edge\webdriver.py", line 34, in __init__ 
self.edge_service.start() 
File "C:\Python27\lib\site-packages\selenium-3.4.3-py2.7.egg\selenium\webdriver\common\service.py", line 102, in start 
raise WebDriverException("Can not connect to the Service %s" % self.path) 

selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service C:\Program Files (x86)\Microsoft Web Driver\MicrosoftWebDriver.exe 

回答

0

this GitHub conversation,该问题可能是网络配置相关。

添加127.0.0.1 localhost到您的计算机的主机文件可能会解决这个问题。