Page 1 of 1

Custom Browser elements in Firefox

Posted: Tue Oct 30, 2012 1:08 am
by ant_katcin
Hello.

In my company I'm a Firefox extension developer. In our extension there are some custom XUL dialogs with XUL browser elements that contain HTML pages. Problem is that Ranorex doesn't recognize those pages as HTML DOM pages. The only thing i can see is accessibility elements. That made me sad, so i looked in Ranorex FF extension and wrore a little script that allow to add custom browser elements to Ranorex:

http://pastebin.com/73rMP8Pw

Usage is like this:

Code: Select all

RMRanorexAttacher.AttachBrowser(document.getElementById("dialog_content_browser"));
Assuming that XUL looks something like this:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="window1" xmlns="http://www.mozilla.org/keymaster/gateke ... s.only.xul" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mozilla.org/keymaster/gateke ... s.only.xul">

  <script src="page_script.js" type="application/x-javascript" />
  <browser id="dialog_content_browser" type="content" flex="1" />
</window>
That works great and i can use DOM of custom browser in Ranorex. Possibly that can help someone else. However, there are some questions, comments and feature requests:

1. There is Ranorex NP plugin that added to every browser window. For now i can't understand how it used and i don't insert it to my XUL page. Should i?

2. Ranorex can easily monitor HTML browser elements by itself. Can that be implemented?

3. Implementation of Firefox extension using XPCOM is terrible as it requires a updates of extension for each FF release. I know what i'm saying and i'm sure that implementation fully can be moved to NP API plugin and pure javascript. In this case you won't need to release new Ranorex version each time FF updates. And i'm sure that won't require a much afford.

Re: Custom Browser elements in Firefox

Posted: Tue Oct 30, 2012 5:06 pm
by Support Team
Hi,

Thanks for the interesting feedback and nice workaround :)
We didnt provide any XUL support because there was no interest whatsoever (until now)

1) the ranorex np plugin is only a dummy (for flash player interaction) and is not required otherwise
2) could you explain that a little bit better?
3) when firefox 3.0 came out it seemed like a good idea... now i agree its a bit of a pain with the new release cycle. it should be possible to move to js/npapi as we already use it for safari/chrome. this idea has been floating around for a while but unfortunately we currently don't have any resources for that.
Also many corporate customers seem to be stuck on 3.6 or 10ESR ...

Michael
Ranorex Dev Team

Re: Custom Browser elements in Firefox

Posted: Wed Oct 31, 2012 10:06 am
by ant_katcin
Support Team wrote:2) could you explain that a little bit better?
Sure. For now Ranorex Firefox extension look for tab browsers only, but it can look for all browser elements in all xul windows. For instance you can do document.getElementsByTagName("browser") on window load. Moreover you can use nsIWindowMediator to add window listener, so you can get browser elements from any custom windows.
Support Team wrote:Also many corporate customers seem to be stuck on 3.6 or 10ESR ...
Js/npapi will work fine for both of versions.
Support Team wrote:this idea has been floating around for a while but unfortunately we currently don't have any resources for that.
You can outsource that. Do you need a remote developer? :wink: