【问题标题】:"Failed to fetch region" (new Error("NO_RESULT", "resource://gre/modules/Region.jsm", 376)) error using GeckoDriver and Firefox through Selenium“无法获取区域”(新错误(“NO_RESULT”,“resource://gre/modules/Region.jsm”,376))错误使用 GeckoDriver 和 Firefox 通过 Selenium
【发布时间】:2020-12-15 17:27:23
【问题描述】:

此代码适用于英文 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")

我认为使用非英语 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

它试图从 appdata 中的临时文件夹运行配置文件。

有没有办法告诉 geckodriver 使用不同的临时文件夹?

【问题讨论】:

    标签: python selenium selenium-webdriver firefox geckodriver


    【解决方案1】:

    此错误消息...

    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))
    

    ...暗示 Firefox 无法在新的 Browsing Context 中触发下载区域地图,即 Firefox Browser 会话为您正在处理一个非英语用户名。


    触发地图下载

    Trigger download of map 的一个已知问题,该问题已通过 changeset 得到解决,并且应该在启用 Mozilla PreferenceFirefox 79 中可用。 p>


    解决方案

    确保:

    【讨论】:

      猜你喜欢
      • 2020-11-05
      • 2020-05-16
      • 2020-05-13
      • 2017-08-30
      • 1970-01-01
      • 2021-12-26
      • 2017-04-04
      • 1970-01-01
      • 2018-03-31
      相关资源
      最近更新 更多