Skip to content

Mono and x64 Firefox exception: 'Could not locate amd64' #1010

@arthot

Description

@arthot

I ran into a problem on mono 3.12.1, centos 6.6 (x64) with firefox 38, but I suppose that the problem is global for Firefox x64:

 
OpenQA.Selenium.WebDriverException : Could not locate amd64: native events will not work.
  at OpenQA.Selenium.Firefox.FirefoxBinary.ExtractAndCheck (OpenQA.Selenium.Firefox.FirefoxProfile profile, System.String noFocusSoName, System.String libraryPath32Bit, System.String libraryPath64Bit) [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxBinary.ModifyLinkLibraryPath (OpenQA.Selenium.Firefox.FirefoxProfile profile) [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxBinary.StartProfile (OpenQA.Selenium.Firefox.FirefoxProfile profile, System.String[] commandLineArguments) [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxDriverServer.Start () [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute (OpenQA.Selenium.Remote.Command commandToExecute) [0x00000] in :0
  at OpenQA.Selenium.Remote.RemoteWebDriver.Execute (System.String driverCommandToExecute, System.Collections.Generic.Dictionary`2 parameters) [0x00000] in :0
  at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession (ICapabilities desiredCapabilities) [0x00000] in :0
  at OpenQA.Selenium.Remote.RemoteWebDriver..ctor (ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxDriver..ctor (OpenQA.Selenium.Firefox.FirefoxBinary binary, OpenQA.Selenium.Firefox.FirefoxProfile profile, ICapabilities capabilities, TimeSpan commandTimeout) [0x00000] in :0
  at OpenQA.Selenium.Firefox.FirefoxDriver..ctor (OpenQA.Selenium.Firefox.FirefoxBinary binary, OpenQA.Selenium.Firefox.FirefoxProfile profile, TimeSpan commandTimeout) [0x00000] in :0

After some investigations in source code of firefox driver I detected potential bug:
https://github.com/SeleniumHQ/selenium/blob/master/dotnet/src/webdriver/Firefox/FirefoxBinary.cs#L346

private void ModifyLinkLibraryPath(FirefoxProfile profile)
        {
            // Extract x_ignore_nofocus.so from x86, amd64 directories inside
            // the jar into a real place in the filesystem and change LD_LIBRARY_PATH
            // to reflect that.
            string existingLdLibPath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH");

            // The returned new ld lib path is terminated with ':'
            string newLdLibPath = ExtractAndCheck(profile, NoFocusLibraryName, "x86", "amd64");
            if (!string.IsNullOrEmpty(existingLdLibPath))
            {
                newLdLibPath += existingLdLibPath;
            }

            this.SetEnvironmentProperty("LD_LIBRARY_PATH", newLdLibPath);

            // Set LD_PRELOAD to x_ignore_nofocus.so - this will be taken automagically
            // from the LD_LIBRARY_PATH
            this.SetEnvironmentProperty("LD_PRELOAD", NoFocusLibraryName);
        }

Previous method is trying to extract 'x_ignore_nofocus.so' file from WebDriver.FirefoxNoFocus.x86.dll and WebDriver.FirefoxNoFocus.amd64.dll.
But according build.desc
there is no fileWebDriver.FirefoxNoFocus.amd64.dll, but only WebDriver.FirefoxNoFocus.x64.dll.
So 'x_ignore_nofocus.so' file for x64 Firefox cannot be extracted and driver throw exception

I could not build the project from sources, so I just changed "amd64" to "x64" at this line

string newLdLibPath = ExtractAndCheck(profile, NoFocusLibraryName, "x86", "amd64");

through ILSpy in WebDriver.dll, and after that my test worked fine on CentOS.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions