[英]“Failed to fetch region” (new Error(“NO_RESULT”, “resource://gre/modules/Region.jsm”, 376)) error using GeckoDriver and Firefox through Selenium
This code works on an English Windows username, but does not on a non-english username此代码适用于英语 Windows 用户名,但不适用于非英语用户名
from seleniumwire import webdriver # Import from seleniumwire
from selenium.webdriver.firefox.options import Options as FirefoxOptions
options = FirefoxOptions()
firefox_profile = webdriver.FirefoxProfile(r'D:\yt\tempProfile')
url = "https://www.google.com/"
try:
driver = webdriver.Firefox(firefox_profile=firefox_profile,options=options)
print("path=",str(driver.firefox_profile.path))
driver.get(url)
finally:
if 'driver' in locals():
driver.quit()
else:
print("driver is none")
I think having a non-english Windows username creates a problem with running geckodriver.我认为使用非英语 Windows 用户名会导致运行 geckodriver 出现问题。
geckodriver.log:壁虎驱动程序日志:
1607996979444 geckodriver INFO Listening on 127.0.0.1:50416
1607996984556 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\88D7~1\\AppData\\Local\\Temp\\rust_mozprofile64HlEP"
1607996985346 Marionette INFO Listening on port 50424
1607996985603 Marionette WARN TLS certificate errors will be ignored for this session
1607996985604 Marionette INFO Proxy settings initialised: {"proxyType":"manual","httpProxy":"127.0.0.1:50414","noProxy":[],"sslProxy":"127.0.0.1:50414"}
1607996986131 Marionette INFO Stopped listening on port 50424
console.error: Region.jsm: "Error fetching region" (new TypeError("NetworkError when attempting to fetch resource.", ""))
console.error: Region.jsm: "Failed to fetch region" (new Error("NO_RESULT", "resource://gre/modules/Region.jsm", 376))
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost
###!!! [Child][MessageChannel::SendAndWait] Error: Channel error: cannot send/recv
its trying to run a profile from temp folder inside appdata.它试图从 appdata 中的临时文件夹运行配置文件。
Is there a way to tell geckodriver to use a different temp folder?有没有办法告诉 geckodriver 使用不同的临时文件夹?
This error message...此错误消息...
console.error: Region.jsm: "Error fetching region" (new TypeError("NetworkError when attempting to fetch resource.", ""))
console.error: Region.jsm: "Failed to fetch region" (new Error("NO_RESULT", "resource://gre/modules/Region.jsm", 376))
...implies that the Firefox was unable to trigger the downloading of region maps within the new Browsing Context ie Firefox Browser session as you are handling a non-english username. ...意味着Firefox无法在新的浏览上下文中触发区域地图的下载,即Firefox 浏览器session 在您处理非英语用户名时。
Trigger download of map was a known issue with mozilla which got addressed through changeset and should be available with Firefox 79 with the Mozilla Preference enabled.map 的触发下载是Mozilla的一个已知问题,该问题已通过变更集得到解决,并且应该在启用Mozilla 偏好设置的Firefox 79中可用。
Ensure that:确保这件事:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.