Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var RMRanorexAttacher = {
- //Add document inside browser to Ranorex, so you can access DOM of this document.
- AttachBrowser: function(browser) {
- var rxResolverCallback = function(browserObj)
- {
- // refresh window from tab
- return browserObj.contentWindow;
- };
- var rxCallback = function(str, arg1, arg2, arg3)
- {
- try
- {
- if (str == "SelectTab")
- {
- //No tabs support
- return null;
- }
- else if (str == "CloseTab")
- {
- //No tabs support
- return null;
- }
- else if (str == "GetZoom")
- {
- return arg1.markupDocumentViewer.fullZoom+'';
- }
- else if (str == "PerformClick")
- {
- ev = document.createEvent('MouseEvents');
- ev.initMouseEvent('click', true, false, arg1, 1, 0, 0, 1, 1, false, false, false, false, 0, null);
- arg2.dispatchEvent(ev);
- }
- }
- catch(e)
- {
- return null;
- }
- };
- const cid = "@ranorex.com/RanorexAutomation3;1";
- var obj = Components.classes[cid].createInstance();
- var rxAutomation = obj.QueryInterface(Components.interfaces.IRanorexAutomation3);
- rxAutomation.AddTabWindow(window, browser, rxCallback, rxResolverCallback);
- rxAutomation.SetSelectedTabWindow(window, browser);
- },
- DetachBrowser: function(browser) {
- const cid = "@ranorex.com/RanorexAutomation3;1";
- var obj = Components.classes[cid].createInstance();
- var rxAutomation = obj.QueryInterface(Components.interfaces.IRanorexAutomation3);
- rxAutomation.RemoveTabWindow(window, browser);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement