Open renas opened 9 years ago
From renasr...@gmail.com on June 23, 2014 00:11:32
Would it be possible for you to share an app that exhibits this issue?
Owner: renasr...@gmail.com
From yashodha...@gmail.com on June 24, 2014 17:23:12
Can you please try to reproduce on the ShareFile app from the Play Store?
From renasr...@gmail.com on November 13, 2014 14:17:59
Would it be possible for you to send us an APK that exhibits this issue? Thanks.
From yashodha...@gmail.com on June 19, 2014 15:31:48
What steps will reproduce the problem? My Robotium test for an Android application is as follows.
public void testLogin() { solo.waitForView(android.webkit.WebView.class); logWebElementsFound(); }
/* * Logs the WebElements currently displayed.
/ private void logWebElementsFound(){ for(WebElement webElement : solo.getCurrentWebElements()){ Log.d("Robotium", "id: '" + webElement.getId() + "' text: '" + webElement.getText() + "' name: '" + webElement.getName() + "' class name: '" + webElement.getClassName() + "' tag name: '" + webElement.getTagName() + "'"); } } What is the expected output? What do you see instead? I am trying to list all the elements of my WebView in the logs. I do not see those and see the following error within my Launcher Activity for a few seconds. After a few seconds, the content on my activity is loaded but I still do not see any WebView elements in the logs. I was able to copy the error from my screen when I was "debugging" the test (as opposed to running it). What version of the product are you using? On what operating system? robotium-solo-5.1.jar Android KitKat Please provide any additional information below. ERROR: Illegal character in fragment at index 5655: javascript:/* * Used by the web methods. * * @author Renas Reda, renas.reda@robotium.com * / function allWebElements() { for (var key in document.all){ try{ promptElement(document.all[key]); }catch(ignored){} } finished(); } function allTexts() { var range = document.createRange(); var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false); while(n=walk.nextNode()){ try{ promptText(n, range); }catch(ignored){} } finished(); } function clickElement(element){ var e = document.createEvent('MouseEvents'); e.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); element.dispatchEvent(e); } function id(id, click) { var element = document.getElementById(id); if(element != null){ if(click == 'true'){ clickElement(element); } else{ promptElement(element); } } else { for (var key in document.all){ try{ element = document.all[key]; if(element.id == id) { if(click == 'true'){ clickElement(element); return; } else{ promptElement(element); } } } catch(ignored){} } } finished(); } function xpath(xpath, click) { var elements = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); if (elements){ var element = elements.iterateNext(); while(element) { if(click == 'true'){ clickElement(element); return; } else{ promptElement(element); element = result.iterateNext(); } } finished(); } } function cssSelector(cssSelector, click) { var elements = document.querySelectorAll(cssSelector); for (var key in elements) { if(elements != null){ try{ if(click == 'true'){ clickElement(elements[key]); return; } else{ promptElement(elements[key]); } }catch(ignored){} } } finished(); } function name(name, click) { var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,null,false); while(n=walk.nextNode()){ try{ var attributeName = n.getAttribute('name'); if(attributeName != null && attributeName.trim().length>0 && attributeName == name){ if(click == 'true'){ clickElement(n); return; } else{ promptElement(n); } } }catch(ignored){} } finished(); } function className(nameOfClass, click) { var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,null,false); while(n=walk.nextNode()){ try{ var className = n.className; if(className != null && className.trim().length>0 && className == nameOfClass) { if(click == 'true'){ clickElement(n); return; } else{ promptElement(n); } } }catch(ignored){} } finished(); } function textContent(text, click) { var range = document.createRange(); var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false); while(n=walk.nextNode()){ try{ var textContent = n.textContent; if(textContent.trim() == text.trim()){ if(click == 'true'){ clickElement(n); return; } else{ promptText(n, range); } } }catch(ignored){} } finished(); } function tagName(tagName, click) { var elements = document.getElementsByTagName(tagName); for (var key in elements) { if(elements != null){ try{ if(click == 'true'){ clickElement(elements[key]); return; } else{ promptElement(elements[key]); } }catch(ignored){} } } finished(); } function enterTextById(id, text) { var element = document.getElementById(id); if(element != null) element.value = text; finished(); } function enterTextByXpath(xpath, text) { var element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue; if(element != null) element.value = text; finished(); } function enterTextByCssSelector(cssSelector, text) { var element = document.querySelector(cssSelector); if(element != null) element.value = text; finished(); } function enterTextByName(name, text) { var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,null,false); while(n=walk.nextNode()){ var attributeName = n.getAttribute('name'); if(attributeName != null && attributeName.trim().length>0 && attributeName == name) n.value=text; } finished(); } function enterTextByClassName(name, text) { var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_ELEMENT,null,false); while(n=walk.nextNode()){ var className = n.className; if(className != null && className.trim().length>0 && className == name) n.value=text; } finished(); } function enterTextByTextContent(textContent, text) { var walk=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null,false); while(n=walk.nextNode()){ var textValue = n.textContent; if(textValue == textContent) n.parentNode.value = text; } finished(); } function enterTextByTagName(tagName, text) { var elements = document.getElementsByTagName(tagName); if(elements != null){ elements[0].value = text; } finished(); } function promptElement(element) { var id = element.id; var text = element.innerText; if(text.trim().length == 0){ text = element.value; } var name = element.getAttribute('name'); var className = element.className; var tagName = element.tagName; var attributes = ""; var htmlAttributes = element.attributes; for (var i = 0, htmlAttribute; htmlAttribute = htmlAttributes[i]; i++){ attributes += htmlAttribute.name + "::" + htmlAttribute.value; if (i + 1 < htmlAttributes.length) { attributes += "#$"; } } var rect = element.getBoundingClientRect(); if(rect.width > 0 && rect.height > 0 && rect.left >= 0 && rect.top >= 0){ prompt(id + ';,' + text + ';,' + name + ";," + className + ";," + tagName + ";," + rect.left + ';,' + rect.top + ';,' + rect.width + ';,' + rect.height + ';,' + attributes); } } function promptText(element, range) { var text = element.textContent; if(text.trim().length>0) { range.selectNodeContents(element); var rect = range.getBoundingClientRect(); if(rect.width > 0 && rect.height > 0 && rect.left >= 0 && rect.top >= 0){ var id = element.parentNode.id; var name = element.parentNode.getAttrib...
Original issue: http://code.google.com/p/robotium/issues/detail?id=616