i am trying to setup a windows application which embeds Geckofx Web Browser. version 45.0.1
I have successfully embedded browser in windows form but when i run application an expection is thrown saying
Unable to load DLL 'mozglue':
Location targeted in xpcom.initialize contains mozglue.dll file. But still there is an error.
Any solution to this ?? how to fix this issue?
- vb.net
- geckofx
asked Sep 14, 2018 at 12:14
NadirNadir
871 silver badge13 bronze badges
2
-
Are you using the GitHub or the nuget version?
Sep 17, 2018 at 22:49
-
Was my answer helpful to you?
Sep 24, 2018 at 21:18
3 Answers
I believe this is caused by missing DLLs that are required to load mozglue
.
-
Check whether the Firefox folder was copied to the output folder and contains these three files:
D3DCompiler_43.dll
,msvcp120.dll
, andmsvcr120.dll
.If not, a vcredist that matches your architecture/build target might be required on some machines.
-
On this related issue on GeckoFX’s bitbucket tracker is also mentioned to check whether the file
omni.ja
is in the Firefox folder after deployment.You need to get
omni.ja
there formozglue.dll
to run! -
Furthermore, it may also be required to specify the location of the Firefox folder manually before initializing:
System.IO.Directory.SetCurrentDirectory(System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.Location)) Xpcom.Initialize("Firefox")
answered Sep 18, 2018 at 0:03
wp78dewp78de
18.2k7 gold badges43 silver badges71 bronze badges
1
-
Thanks! For C# WPF I’ve used: System.IO.Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); Gecko.Xpcom.Initialize(«Firefox»);
Nov 17, 2021 at 10:39
in my case installing Visual C++ Redistributable for Visual Studio 2015 fix the problem.
my case: run program on VPS Unable to load DLL ‘mozglue’…
my program is 32bit and written with VS 2015, So i just download and install 32bit version of C++ 2015.
answered Jun 2, 2019 at 14:05
reza jafarireza jafari
1,22813 silver badges14 bronze badges
Installed below redistributable to make it all work.
UkFLSUI
5,5196 gold badges32 silver badges47 bronze badges
answered Sep 8, 2019 at 2:41
Сообщение исключения
"Не удается загрузить DLL "mozglue": Не найден указанный модуль. (Исключение из HRESULT: 0x8007007E)"
Трассировка стека
в Gecko.Xpcom.Alloc(IntPtr size)
в Gecko.nsAString..ctor() в D:\temp\339b193\Geckofx-Core\nsString.cs:строка 883
в Gecko.nsAString..ctor(String value) в D:\temp\339b193\Geckofx-Core\nsString.cs:строка 895
в Gecko.Xpcom.Initialize(String binDirectory) в D:\temp\339b193\Geckofx-Core\Xpcom.cs:строка 324
в mRemoteNG.UI.Window.ComponentsCheckWindow.CheckGeckoBrowser() в C:\jenkins\workspace\Publish\Build mRemoteNG for Release\mRemoteV1\UI\Window\ComponentsCheckWindow.cs:строка 722
в mRemoteNG.UI.Window.ComponentsCheckWindow.CheckComponents() в C:\jenkins\workspace\Publish\Build mRemoteNG for Release\mRemoteV1\UI\Window\ComponentsCheckWindow.cs:строка 546
в mRemoteNG.UI.Window.ComponentsCheckWindow.btnCheckAgain_Click(Object sender, EventArgs e) в C:\jenkins\workspace\Publish\Build mRemoteNG for Release\mRemoteV1\UI\Window\ComponentsCheckWindow.cs:строка 515
в System.Windows.Forms.Control.OnClick(EventArgs e)
в System.Windows.Forms.Button.OnClick(EventArgs e)
в System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
в System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.ButtonBase.WndProc(Message& m)
в System.Windows.Forms.Button.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Environment
OS: Microsoft Windows NT 10.0.18362.0
mRemoteNG Version: 1.77.0.41252
Edition: MSI
Cmd line args:
System
- Version: geckodriver-v0.19.1-win64
- Platform: Windows Server 2012R2
- Firefox: 57.0.4 (64-bit)
- Selenium: selenium-server-standalone-3.8.1
- Language: Java8
- Integration with Bamboo
Testcase
We are using Bamboo (Bamboo agent are running as service on our Window server box). Everything ws OK with old version of Firefox (50.0), but since we update it to the last version (57.0.4), our tests failed with the following logs (cf. plan-27100469-PRODCHROME-59.log):
build 22-Jan-2018 16:32:04 [testng] ###!!! [Parent][MessageChannel] Error: (msgtype=0x15008F,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng] ###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng] ###!!! [Parent][MessageChannel] Error: (msgtype=0x15008F,name=PBrowser::Msg_UpdateNativeWindowHandle) Channel error: cannot send/recv
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng]
build 22-Jan-2018 16:32:04 [testng] ###!!! [Parent][MessageChannel] Error: (msgtype=0x150083,name=PBrowser::Msg_Destroy) Channel error: cannot send/recv
build 22-Jan-2018 16:32:04 [testng]
I also attach the Firefox profile folder: rust_mozprofile.fmglif8m47VA.zip
Stacktrace
plan-27100469-PRODCHROME-59.log
Trace-level log
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(false);
options.setCapability(«browser.tabs.remote.autostart», «true»);
options.setCapability(«browser.tabs.remote.autostart.1», «true»);
options.setCapability(«browser.tabs.remote.autostart.2», «true»);
options.setCapability(«security.sandbox.content.level», «4»);
options.setLogLevel(FirefoxDriverLogLevel.TRACE);
WebDriver wb = new FirefoxDriver(options);
More information
Everything is fine when running the same code locally. The problem only happen when running our tests from Bamboo agent.
I saw similar issues but not exactly the same. I wonder if we can have more information from the log to try to identify the problem.
Thanks Henrik. I am gonna try that and will let you know the result.
Indeed, seems to be the same problem than #466:
- It doesn’t work with Firefox 58.0b16 or the official 58.0,
- It work with the Firefox nightly [no need to set the «security.sandbox.content.level» capabilities on gecko driver].
Is there any solution for using the official firefox release?
@Eskampette just use the same sandbox level as for Nightly (please note that it could mean some unforeseen misbehavior given that we don’t use that value on purpose on releases yet), or use the Nightly version of Firefox for now. I would suggest that you do the former first.
Marking issue as dupe of #466.
@whimboo, on nightly, the «security.sandbox.content.level» is set to «5». I tried to use the same with Firefox 58.0 (or beta) but it does not work using this piece of code when using Gecko driver (Java):
FirefoxOptions options = new FirefoxOptions();
options.setCapability("security.sandbox.content.level", "5");
WebDriver wb = new FirefoxDriver(options);
Is it the right thing to do?
As a side note I should say that I really don’t have a clue about the meaning of the «security.sandbox.content.level» property and expected behavior with different value.
security.sandbox.content.level
is a preference, not a WebDriver capability. You will want to pass it in to the moz:firefoxOptions
dictionary. See the README.
Thanks @andreastt. As I use Java FirefoxOptions, I think I can use the preference:
FirefoxOptions options = new FirefoxOptions();
options.addPreference("security.sandbox.content.level", "5");
WebDriver wb = new FirefoxDriver(options);
From the log (which seems to follow the README):
build 24-Jan-2018 13:37:15 [testng] 2018/01/24 13:37:14.970 INFO [com.foliofn.selenium.util.webdriver.WebDriverFactory][main]: Firefox options: {acceptInsecureCerts=true, browserName=firefox, moz:firefoxOptions={args=[], prefs={security.sandbox.content.level=5}}}
However, it still doesn’t work with Firefox 58.0.
It seems that my problem was more about the way to set the «moz:firefoxOptions» preference with Java…
It work with Firefox 58.0 using the following code:
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(true);
options.addPreference("browser.tabs.remote.autostart", false);
options.addPreference("browser.tabs.remote.autostart.2", false);
options.addPreference("security.sandbox.content.level", "5");
WebDriver wb = new FirefoxDriver(options);
Thanks for your support.
@Eskampette out of interest why are you disabling multi-process (e10s) in Firefox? Is there anything which fails in your case?
@whimboo, we switch back to Firefox 57.0.4 (do not ask me why…) and, from our tests (*), it works only with this configuration (headless is not necessary):
FirefoxOptions options = new FirefoxOptions();
options.addPreference("browser.tabs.remote.autostart", false);
options.addPreference("browser.tabs.remote.autostart.2", false);
options.addPreference("security.sandbox.content.level", "5");
(*) Selenium tests is running on Bamboo as a window service.
So what fails if you remove those two preferences? It would be great if you could check that, also because since 58 got released the 57.0.4 is no longer officially supported. A trace log of the failure would be great to have. Thanks.
@whimboo, if I remove this 2 preferences, the Gecko Driver cannot connect to Firefox: initial problem reported on this ticket.
Here are the log / profile when running my tests against Firefox 58.0 (Same selenium / gecko driver version), and with the following preferences:
FirefoxOptions options = new FirefoxOptions();
options.addPreference("security.sandbox.content.level", "5");
options.setLogLevel(FirefoxDriverLogLevel.TRACE);
plan-27100469-PRODCHROME-116.log
rust_mozprofile.F2b5kcDaeKfe.zip
Let me know if you need anything else.
@whimboo,
> Could you try to test with a recent Firefox 59 beta or even 60 Nightly?
Last time we test it works with the nightly, without the specific preferences (c.f. this comment).
It doesn’t work with the beta.
> Are you using any AV software which could interfere here?
No, I don’t think so, but I will speak with our admin. team. Yes, we have an AV, but I don’t think it’s a problem here. We have several servers with the same configuration (including AV). Our Bamboo plans are OK we everything else.
The problem happen only with the last Firefox update.
From my understanding of Selenium logs, the Gecko driver failed to connect with Firefox. is the «security.sandbox.content.level» has anything to do with such connection stuff?
Please note that Nightly is always special and could have a different value for security.sandbox.content.level
. You want to check that and then apply the same level to the profile when running with a beta build.
@whimboo, do you want me to test and attach the log / profile?
(!) Since we need to re-install firefox on our integration boxes, it might take a while before tests (and since it work now)… Keep you posted.
If you could do that, it would be great, yes.
Good morning,
I have a similar problem using this system:
Version: geckodriver-v0.19.1-win64
Platform: Windows Server 2012R2
Firefox: 58 (64-bit)
Selenium: selenium-server-standalone-3.8.1
Language: Java8
Integration with Bamboo
It is similar to this issue but the problem is that the browser doesn´t launch in the machine.
I run the plan in bamboo, the job starts and I see the traces:
20-Feb-2018 11:22:03 [INFO] ——————————————————-
20-Feb-2018 11:22:03 [INFO] T E S T S
20-Feb-2018 11:22:03 [INFO] ——————————————————-
20-Feb-2018 11:22:04 [INFO] Running.PREnhTest
20-Feb-2018 11:22:05 DEBUG ConfigurationUtils — ConfigurationUtils.locate(): base is null, name is config.properties
20-Feb-2018 11:22:05 DEBUG ConfigurationUtils — Loading configuration from the context classpath (config.properties)
20-Feb-2018 11:22:05 DEBUG ConfigurationUtils — ConfigurationUtils.locate(): base is null, name is urls.properties
20-Feb-2018 11:22:05 DEBUG ConfigurationUtils — Loading configuration from the context classpath (urls.properties)
20-Feb-2018 11:22:06 1519122126939 geckodriver INFO geckodriver 0.19.1
20-Feb-2018 11:22:06 1519122126939 geckodriver INFO Listening on 127.0.0.1:3412
20-Feb-2018 11:22:08 1519122128001 mozrunner::runner INFO Running command: «C:\Program Files\Mozilla Firefox\firefox.exe» «-marionette» «-profile» «C:\Windows\system32\config\systemprofile\AppData\Local\Temp\rust_mozprofile.bhUlm5SkhK2x»
20-Feb-2018 11:22:08 1519122128780 Marionette INFO Enabled via —marionette
20-Feb-2018 11:22:10 1519122130573 Marionette INFO Listening on port 61319
20-Feb-2018 11:22:11 1519122131153 Marionette WARN TLS certificate errors will be ignored for this session
20-Feb-2018 11:22:11 Feb 20, 2018 11:22:11 AM org.openqa.selenium.remote.ProtocolHandshake createSession
20-Feb-2018 11:22:11 INFO: Detected dialect: W3C
20-Feb-2018 11:22:11 DEBUG SeleniumTest — TestMethod: nh001Test
The testSuite start and I see the trace in the bamboo logs, Notifying me that the testcases are working, but the doubt it is that in windows Server 2012R12 the browser doesn´t launch(firefox not open).
¿Why this happens?¿The testSuite it runnings?¿Who can I launch the browser?
The idea it is to cacth a picture when the TestCase fail.
I am using this configuration in my code:
private static FirefoxOptions firefoxOptions() {
FirefoxOptions optionsFireFox = new FirefoxOptions();
optionsFireFox.addPreference(«browser.tabs.remote.autostart», false);
optionsFireFox.addPreference(«browser.tabs.remote.autostart.2», false);
optionsFireFox.addPreference(«security.sandbox.content.level», «5»);
return optionsFireFox;
}
public static WebDriver setupSelenium(String browser, String browserRC) {
WebDriver driver=null;
UrlProperties.leerUrlPropiedades();
File driverFileFirefox= new File(UrlProperties.getFirefoxDriver());
System.setProperty("webdriver.gecko.driver", driverFileFirefox.getAbsolutePath());
String browserAux=browser;
switch(browser) {
case ConstantConfigTest.FIREFOX:
driver=new FirefoxDriver(firefoxOptions());
break;
case ConstantConfigTest.CHROME:
driver=new ChromeDriver(chromeOptions());
break;
default:
break;
}
Other problem it is with the chrome that give me the following error:
Chrome not reachable
I would like to execute the CI with bammbo remote agent and chrome or firefox opened in windows server 2012R12 to view the testsuite executation.
Sorry to write in a closed issue.
Regard
@franciscosan, I am not part of the support team, but if you launch your Selenium test with Bamboo, you will not see any browser open, not matter it’s Firefox / Chrome.
Indeed, Bamboo runs plan based on agents, which are running on a server box (windows Server 2012R12 on your case). Those agents are running as a Window service, hence they are using a special window session, with no access to local desktop. However, your browser is running internally, which allow your tests to be executed.
Here our piece of (Java) code to take a screenshot. You can give it a try:
import org.apache.commons.io.FileUtils;
private static final String SCREENSHOT_DIR = "screenshots";
public final class SeleniumUtils {
public static final void screenshot(WebDriver wd, String destFile) {
try {
File srcFile = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(srcFile, getFileWithTimestamp(SCREENSHOT_DIR, destFile));
} catch (Throwable t) {
logger.warn("Error while taking screenshot on " + destFile, t);
}
}
}
From what I understood from your description, the problem is not the same than mine. So it should be threaded on a different ticket.
@Eskampette thank you so much for the answer. I did not know that functionality of the windows service.
I have used the code that you provide me and it is working .
I execute the bamboo agent and browser is not launch but it take the picture of the error detected.
So with the explanation of the Window service functionality that you give me, the function is considered correct with the system that I am using.
Thank so much.
Regard
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.
lock
bot
locked and limited conversation to collaborators
Aug 16, 2019
Мне была поставлена задача интегрировать компонент браузера Gecko
в существующий элемент управления winform, но проблема, с которой я столкнулся, заключается в том, как настроить dll, я также пытаюсь использовать другую версию, но не повезло, на данный момент она не загружает dll и дает Ошибка
Unable to find an entry point named 'NS_Alloc' in DLL 'xul'.
Я скачал отдельно по данной ссылке. Xulrunner последний, а также 29, но он говорит:
An error occurred creating the form. See Exception.InnerException for details. The error is: Unable to load DLL 'xul': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Imports System.IO
Импорт System.Xml Импорт Gecko Импорт Microsoft.Win32
Открытый класс Form1
Public Sub New()
InitializeComponent()
'D:\xulrunner\bin
Xpcom.Initialize("D:\\xulrunner\\") 'xulrunner
'Xpcom.Initialize("C:\Program Files (x86)\Mozilla Firefox\")
End Sub
Конец класса
пожалуйста, помогите мне, если кто-то уже сделал с этим.
Установлены wine-full-2.21.0-alt1.noarch wine-gecko-2.47-alt1.noarch i586-wine-2.21.0-alt1.i586 При первом запуске winecfg ругается, что gecko не найден, и предлагает или забить, или скачать из сети. Ожидается, что winecfg должен найти установленные *.msi и предложить их запустить.
Исправлено. Более того, используется gecko в распакованном виде, работающий прямо из файловой системы. |