FirefoxProfile的路径太长异常

时间:2019-05-06 10:10:14

标签: c# firefox selenium-webdriver

使用 FirefoxProfile 启动 FirefoxDriver 会导致异常The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

捕获:这是Windows用户“ 管理员”的行为,用户名较短,例如“ xxxxx ”,没有观察到此类异常。

此行为很可能取决于所使用的配置文件和https://blog.mozilla.org/addons/2019/05/04/update-regarding-add-ons-in-firefox/-已安装一些插件(+ -15),但在mozilla修复所有补丁之前,都没有例外。

使用的版本

  • 硒3.141 / 4.0 alpha
  • geckodriver 64位0.23 / 0.24
  • Firefox 64位66.0.3 / 66.0.4
FirefoxProfile _FirefoxProfile = new FirefoxProfile(SeleniumFirefoxProfileDirectory); //"C:\\Temp\\FirefoxProfiles\\p2"
FirefoxDriverService driverService = FirefoxDriverService.CreateDefaultService();
FirefoxOptions options = new FirefoxOptions();
options.Profile = _FirefoxProfile;

IWebDriver driver = new FirefoxDriver(driverService,options,TimeSpan.FromMinutes(3));   

StackTrace

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
   at System.IO.DirectoryInfo.Create()
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Internal.FileUtilities.CopyDirectory(String sourceDirectory, String destinationDirectory)
   at OpenQA.Selenium.Firefox.FirefoxProfile.WriteToDisk()
   at OpenQA.Selenium.Firefox.FirefoxProfile.ToBase64String()
   at OpenQA.Selenium.Firefox.FirefoxOptions.GenerateFirefoxOptionsDictionary()
   at OpenQA.Selenium.Firefox.FirefoxOptions.ToCapabilities()
   at OpenQA.Selenium.Firefox.FirefoxDriver.ConvertOptionsToCapabilities(FirefoxOptions options)
   at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout)

0 个答案:

没有答案