问题描述
我用Python创建了一个脚本,该脚本废弃了Altium的网站并收集了有关许可证使用情况的信息.目前,我正在使用ChromeDriver,但有时由于网络在一天中的不同时间运行缓慢而会出现错误.我在个人计算机上使用MicrosoftWebDriver(Edge)使用了相同的脚本,但未收到任何错误.启动MicrosoftWebDriver.exe(可从其网站下载)时,它应该打开Edge,但是当我使用公司的笔记本电脑时,什么也没发生(请参见图片).
I created a script in Python, which scraps the Altium's website and gathers information regarding license usage. At this moment, I am using ChromeDriver, but I sometimes get errors due to the network being slow at different times of the day. I used the same script using the MicrosoftWebDriver (Edge) on my Personal Computer and I received no errors. When you launch the MicrosoftWebDriver.exe (downloaded from their website) it should open Edge, but when I use my company's laptop, nothing happens (see attached picture).
我是否有可能解决此问题?这是由于端口被阻塞导致的吗?
Is there any chance I can fix this? Is this happening as a result of the port being blocked?
这是我用于选择网络驱动程序的代码:
This is the code I am using for selecting the webdriver:
browser = webdriver.Edge(r'C:\ALTIUM_WORK\Altium_Python\MicrosoftWebDriver.exe')
这是我得到的错误":
此后没有任何反应...
And nothing happens after this...
Python的Shell这样说:
The Python's Shell says this:
Traceback (most recent call last):
File "C:\ALTIUM_WORK\Altium_Python\Altium_H1.py", line 172, in <module>
browser = webdriver.Edge(r'C:\ALTIUM_WORK\Altium_Python\MicrosoftWebDriver.exe')
File "C:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\edge\webdriver.py", line 66, in __init__
desired_capabilities=capabilities)
File "C:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Program Files (x86)\Python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Unknown error
推荐答案
browser = webdriver.Edge(r'C:\ALTIUM_WORK\Altium_Python\MicrosoftWebDriver.exe')
这不起作用,因为在您的办公室笔记本电脑中,User Account Control settings
是Turned Off
.
This is not working because in your office laptop User Account Control settings
is Turned Off
.
您需要打开User Account Control settings
并重新启动计算机,然后运行您的代码.它将按预期工作.
You need turned On User Account Control settings
and restart your machine and then run your code.It will work as expected.
要在OS上进入路径:
Control Panel-->All Control Panel Items-->User Accounts--> Change User Account Control settings
这篇关于selenium.common.exceptions.WebDriverException:消息:尝试通过Selenium使用Edge和MicrosoftWebDriver.exe时发生未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!