From 5f5bd8e3fc956134806785841d7c41422c262f16 Mon Sep 17 00:00:00 2001 From: tfreitasleal Date: Thu, 5 Oct 2017 19:35:42 +0100 Subject: [PATCH 1/2] * Fix to When the JS function passed to selectorExecute has // comments in it, Webdriver fails with the error "Failed: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected end of input". https://github.com/webdriverio/webdriverio/issues/2172 --- .../resources/javascript/getContentElement.js | 2 +- src/main/resources/javascript/qxh.js | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/resources/javascript/getContentElement.js b/src/main/resources/javascript/getContentElement.js index 87f1672..02a9264 100644 --- a/src/main/resources/javascript/getContentElement.js +++ b/src/main/resources/javascript/getContentElement.js @@ -25,7 +25,7 @@ var getContentElement = function() { throw new Error("Widget " + widget.toString() + " has no content element!"); } - // contentElement is the DOM element in qx.ui.mobile.core.Widget + /* contentElement is the DOM element in qx.ui.mobile.core.Widget */ if (contentElement.nodeType && contentElement.nodeType === 1) { return contentElement; } diff --git a/src/main/resources/javascript/qxh.js b/src/main/resources/javascript/qxh.js index fb3af94..cf5b449 100644 --- a/src/main/resources/javascript/qxh.js +++ b/src/main/resources/javascript/qxh.js @@ -49,7 +49,7 @@ return (function(args) { console.log("Qxh searching for seeable and non-seeable widgets."); } this.root = this.getRoot(rootElement); - //this._iframeQxObject = null; + /* this._iframeQxObject = null; */ this.seenNodes = []; }; @@ -77,8 +77,8 @@ return (function(args) { } else if (this.appType == "inline") { root = qx.ui.core.Widget.getWidgetByElement(rootArg); if (!root && rootArg.firstChild) { - // If the inline root is configured to respect the DOM - // element's original dimensions, an additional div is created: + /* If the inline root is configured to respect the DOM + element's original dimensions, an additional div is created: */ root = qx.ui.core.Widget.getWidgetByElement(rootArg.firstChild); } } @@ -133,13 +133,13 @@ return (function(args) { var c; /* If the node is one of the qooxdoo Iframes (html or ui.embed) containing - * another qooxdoo application, try to retrieve its root widget */ + another qooxdoo application, try to retrieve its root widget */ if ( node.classname && (node.classname.indexOf("Iframe") + 6 == node.classname.length) && node.getWindow) { console.log("getQxNodeDescendants: using getWindow() to retrieve descendants"); try { /* store a reference to the iframe's qx object. This is used by - Selenium.getQxWidgetByLocator */ - //this_iframeQxObject = node.getWindow().qx; + Selenium.getQxWidgetByLocator + this_iframeQxObject = node.getWindow().qx; */ descArr.push(node.getWindow().qx.core.Init.getApplication().getRoot()); } catch (ex) { @@ -406,7 +406,7 @@ return (function(args) { Qxh.prototype.getQxElementFromStep1 = function(root, step) { - // find an object member of root with name 'step' + /* find an object member of root with name 'step' */ console.log("Qxh Locator: in getQxElementFromStep1"); var member; @@ -424,7 +424,7 @@ return (function(args) { Qxh.prototype.getQxElementFromStep2 = function(root, qxclass) { - // find a child of root with qooxdoo type 'qxclass' + /* find a child of root with qooxdoo type 'qxclass' */ console.log("Qxh Locator: in getQxElementFromStep2"); var childs; var curr; @@ -457,13 +457,13 @@ return (function(args) { Qxh.prototype.getQxElementFromStep3 = function(root, childspec) { - // find a child of root by index + /* find a child of root by index */ console.log("Qxh Locator: in getQxElementFromStep3"); var childs; var idx; var m; - // extract child index + /* extract child index */ m = /child\[(-?\d+)\]/i.exec(childspec); if ((m instanceof Array) && m.length > 1) { @@ -474,7 +474,7 @@ return (function(args) { childs = this.getQxNodeDescendants(root); - // Negative index value: Reverse access + /* Negative index value: Reverse access */ if (idx < 0 ) { if (Math.abs(idx) > childs.length) { return null; @@ -493,7 +493,7 @@ return (function(args) { Qxh.prototype.getQxElementFromStep4 = function(root, attribspec) { - // find a child of root by attribute + /* find a child of root by attribute */ console.log("Qxh Locator: in getQxElementFromStep4"); var childs; var attrib; @@ -502,7 +502,7 @@ return (function(args) { var actobj; var m; - // extract attribute and value + /* extract attribute and value */ m = /\[@([^=]+)(?:=(.+))?\]$/.exec(attribspec); if ((m instanceof Array) && m.length > 1) @@ -513,12 +513,12 @@ return (function(args) { { attval = m[2]; - // strip possible quotes from attval + /* strip possible quotes from attval */ if (attval.match(/^['"].*['"]$/)) { attval = attval.slice(1, attval.length - 1); } - // it's nice to match against regexp's + /* it's nice to match against regexp's */ rattval = new RegExp(attval); } @@ -528,12 +528,12 @@ return (function(args) { return null; } - if (attval == null) // no compare value -> attrib on root must contain obj ref + if (attval == null) /* no compare value -> attrib on root must contain obj ref */ { actobj = this.getGeneralProperty(root, attrib); if (typeof(actobj) == "object") { - return actobj; // only return an obj ref + return actobj; /* only return an obj ref */ } else { return null; @@ -544,14 +544,14 @@ return (function(args) { for (var i=0; i 0 ) { var keyval = attval.split(":"); console.log("Qxh Locator: Attribute Step: Checking for userData field " + keyval[0] + " with value " + keyval[1]); @@ -586,7 +586,7 @@ return (function(args) { } } - // then, check normal JS attribs + /* then, check normal JS attribs */ if ((attrib in actobj) && ((String(actobj[attrib])).match(rattval))) { console.log("Qxh Locator: Attribute Step: Checking for JS object property"); @@ -607,7 +607,7 @@ return (function(args) { var qxclass = qx.Class.getByName(actobj.classname); */ if (actobj.constructor) { - var hasProp = qx.Class.hasProperty(actobj.constructor, attrib); // see qx.Class API + var hasProp = qx.Class.hasProperty(actobj.constructor, attrib); /* see qx.Class API */ if (hasProp) { From 85411095c357aa9ad6cd063f97d93656f65c02b0 Mon Sep 17 00:00:00 2001 From: tfreitasleal Date: Fri, 6 Oct 2017 00:30:58 +0100 Subject: [PATCH 2/2] Fix Inspector URI. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93d0641..71cafcf 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The best way to learn about the various Widget interfaces is to check out the sa WebDriver's built-in _"By"_ strategies like _By.xpath_ or _By.className_ generally don't work too well with the entangled and dynamic DOM structures generated by qx.Desktop applications. The _By.qxh_ strategy (qx for qooxdoo, h for hierarchy) provides an alternative approach that searches for elements by using JavaScript to traverse the application's widget hierarchy. -For example, the [qooxdoo Feed Reader](http://demo.qooxdoo.org/current/feedreader/)'s UI hierarchy looks like this (easily determined by opening the Feed Reader in the [Inspector](http://demo.qooxdoo.org/current/inspector/)): +For example, the [qooxdoo Feed Reader](http://demo.qooxdoo.org/current/feedreader/)'s UI hierarchy looks like this (easily determined by opening the Feed Reader in the [Inspector](http://www.qooxdoo.org/Inspector/)): qx.ui.root.Application - qx.ui.container.Composite