selenium-google-code-issue-archive
selenium-google-code-issue-archive copied to clipboard
Adding functionality for noFocusLib on Linux
Originally reported on Google Code with ID 8097
sorry for bad english =)
Linux have bug when runs 2+ firefox - "window focus" only on last FF.
For this trouble where is lib - x_ignore_nofocus.so, which load if FF on Linux and
have flags (enableNativeEvents or loadNoFocusLib in FirefoxProfile.java)
Problem is -I run tests with RemoteWebDriver, and DesiredCapabilities only have "nativeEvents"
parameter, but I want:
enableNativeEvents = false and loadNoFocusLib = true
because there is bug in linux + firefox if "enableNativeEvents = true" - https://code.google.com/p/selenium/issues/detail?id=4198.
But where is no parameter in DesiredCapabilities for loadNoFocusLib
So I create commit which enable loadNoFocusLib on RemoteWebDriver without "enableNativeEvents
= true" on Linux (in attach)
Can this path be applied in default SeleniumRC ? (I test this path - work correctly
for me on Linux)
Reported by ZaharkovArtem
on 2014-10-27 10:09:04
- _Attachment: [LoadNoFocusLibForLinux.diff](https://storage.googleapis.com/google-code-attachments/selenium/issue-8097/comment-0/LoadNoFocusLibForLinux.diff)_
Reported by barancev
on 2014-10-27 11:07:55
- Labels added: OpSys-Linux, Browser-Firefox
Please can you explain why you need x_ignore_nofocus.so?
Reported by vlotoshnikov
on 2014-11-11 21:58:34
When I parallelize tests on linux, focus is only on the last window (for Firefox), hence
the validation associated with the focus is only work on the last open window
Reported by ZaharkovArtem
on 2014-11-13 08:11:17
Opps, I missed your answer. Didn't mean ignoring, sorry!
On Linux I recommend you strongly consider running each Firefox session/window in its
own X display. Focus related issues and other ways browsers can interfere will cease.
For each FirefoxDriver session start an Xvfb and set its display id using Forefox#setEnvironmentProperty():
https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java?name=selenium-2.44.0#62
firefoxBinary.setEnvironmentProperty("DISPLAY", ":12345"); // :12345 is a display served
by an Xvfb process.
You can execute that custom logic on your client/test side (if the client library you
use has an equivalent of firefoxBinary.setEnvironmentProperty() of Java) or inside
a Selenium Java Server.
Do not forget to always kill Xvfb processes after the corresponding FirefoxDriver gets
a quit() call.
Maybe it is because I've been using such setup (with display per browser) for a long
time that I am surprised focus related issues are even possible when synthetic (opposite
of native) events are used with FirefoxDriver.
As for the diff you proposed, it adds something FirefoxDriver specific (and something
that Marionette will make obsolete soon) to the common CapabilityType, that is not
a great idea. Also, it you prefer the NoFocusLib over separate displays, why don't
you simply call the public FirefoxProfile#setAlwaysLoadNoFocusLib() ?
Reported by vlotoshnikov
on 2014-11-27 09:06:12
Good idea with X display. I will try to implement it. Thank you!
But what about setAlwaysLoadNoFocusLib:
I run the tests from Windows, and send them on RemoteWebDriver which on Lunix. This
is where the problem lies
The code:
"if (isOnLinux()
&& (profile.areNativeEventsEnabled() || profile.shouldLoadNoFocusLib())) {
modifyLinkLibraryPath(profileDir);
}"
will run on Windows (!) then I run test, and isOnLinux() = false. So RemoteWebDriver
not load lib.
To be honest, I do not find how remotewebdriver affect the parameter in profile.shouldLoadNoFocusLib().
It is therefore requested to add it to capabilities
Reported by ZaharkovArtem
on 2014-11-28 15:44:50
For one, you may want to modify your isOnLinux() check to return true if the webdriver
session that is about be started is going to run on Linux. Indeed, in the example code
you have pasted, how does it matter where that code is running? What makes the difference
is where the browser will start.
But then it looks like you cannot pass FirefoxProfile#loadNoFocusLib property over
the wire anyway; it will be reset to false when restoring FirefoxProfile from capabilities
on the Selenium Server:
https://code.google.com/p/selenium/source/browse/java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java#112
If I were you I would have probably changed the above linked line to " loadNoFocusLib
= true;", recompile, and run such patched Selenium Server on your Linux machines. Looks
like that would fix all your problems, right?
I am not aware of many users who would benefit from change around loadNoFocusLib, or
who are affected by this issue you propose to fix. (If there are many affected users
who I don't know about, please inform me). And we hope that Marionette, the new WebDriver
for Firefox will come soon and render this issue obsolete. For those reasons I'm not
inclined to push a change to address this issue.
Reported by vlotoshnikov
on 2014-11-30 08:02:41
Yeap, I've done something like this "loadNoFocusLib = true;", but through the parameter
in capabilities in RemoteWebDriver, and run with it.
In any case, it has been only a proposal. If Marionette will solve this problem, it
will be greate! I will be wait =)
Thanks!
Reported by ZaharkovArtem
on 2014-12-01 07:14:46
Reported by luke.semerau
on 2015-09-17 17:47:30
- Labels added: Restrict-AddIssueComment-Commit