Hi Jian, Thanks for taking a look. Do you know how I could increase the timeout of the isElementPresented call?
On the page under test there are some frames, but when I run "findElementOrNull" from FBLite it returns within a couple of seconds. Is there a possibility that the bundle processor is timing out here? If so is it possible to increase this on a case basis? Thanks On Mar 22, 6:31 pm, Jian Fang <[email protected]> wrote: > But, if we trace the execution flow of Selenium isElementPresent() api as > follows, > > Selenium.prototype.isElementPresent = function(locator) { > /** > * Verifies that the specified element is somewhere on the page. > * @param locator an <a href="#locators">element locator</a> > * @return boolean true if the element is present, false otherwise > */ > var element = this.browserbot.findElementOrNull(locator); > if (element == null) { > return false; > } > return true; > > }; > > * Finds an element on the current page, using various lookup protocols > */ > BrowserBot.prototype.findElementOrNull = function(locator, win) { > locator = parse_locator(locator); > > if (win == null) { > win = this.getCurrentWindow(); > } > var element = this.findElementRecursive(locator.type, locator.string, > win.document, win); > > if (element != null) { > return this.browserbot.highlight(element); > } > > // Element was not found by any locator function. > return null; > > }; > > BrowserBot.prototype.findElementRecursive = function(locatorType, > locatorString, inDocument, inWindow) { > > var element = this.findElementBy(locatorType, locatorString, inDocument, > inWindow); > if (element != null) { > return element; > } > > for (var i = 0; i < inWindow.frames.length; i++) { > // On some browsers, the document object is undefined for > third-party > // frames. Make sure the document is valid before continuing. > if (inWindow.frames[i].document) { > element = this.findElementRecursive(locatorType, locatorString, > inWindow.frames[i].document, inWindow.frames[i]); > > if (element != null) { > return element; > } > } > } > > }; > > Seems your observation of infinite loop is actually a normal behavior for > Selenium to repeatedly locate the element from different frames > as shown in the findElementRecursive() function and it should return null > eventually. Your root cause seems to be caused by > timeout as shown in the log, > > "com.thoughtworks.selenium. > HttpCommandProcessor.throwAssertionFailureExceptionOrError: > com.thoughtworks.selenium.SeleniumException: ERROR: Command timed out: > ERROR: Command timed out * Mon Mar 22 17:20:49 GMT 2010" > > Perhaps you have many frames in your web page and IE8 is slow to search them > one by one? How about to increase the timeout threshold > for the isElementPresented() call? > > Thanks, > > Jian > > > > On Mon, Mar 22, 2010 at 2:22 PM, Jian Fang <[email protected]> wrote: > > That is kinda strange. Seems the locate function has returned to Selenium > > API isElementPresented() call. > > > This is proved from the log and the following code snippet. > > > Tellurium.prototype.locateElementWithCacheAware = function(locator, > > inDocument, inWindow){ > > var element = null; > > > var json = locator; > > !tellurium.logManager.isUseLog || fbLog("JSON presentation of the cache > > aware locator: ", json); > > var cal = JSON.parse(json, null); > > !tellurium.logManager.isUseLog || fbLog("Parsed cache aware locator: ", > > cal); > > > !tellurium.logManager.isUseLog || fbLog("Tellurium Cache option: ", > > this.isUseCache()); > > if (this.isUseCache()) { > > //if Cache is used, try to get the UI element from the cache first > > element = this.getUiElementFromCache(cal.rid); > > !tellurium.logManager.isUseLog || fbLog("Got UI element " + cal.rid > > + " from Cache.", element); > > > if (element != null) { > > //need to validate the result from the cache > > !tellurium.logManager.isUseLog || fbLog("Trying to validate the > > found UI element " + cal.rid, element); > > if (!validateDomRef(element)) { > > fbError("The UI element " + cal.rid + " from cache is not > > valid", element); > > this.cache.relocateUiModule(cal.rid); > > //after relocating the UI module, retry to get the UI > > element from the cache > > element = this.getUiElementFromCache(cal.rid); > > !tellurium.logManager.isUseLog || fbLog("After relocating > > UI module, found ui element" + cal.rid, element); > > } > > }else{ > > if(cal.locator != null && cal.locator.trim().length > 0){ > > //If cannot find the UI element from the cache, locate it > > as the last resort > > !tellurium.logManager.isUseLog || fbLog("Trying to locate > > the UI element " + cal.rid + " with its locator " + cal.locator + " because > > cannot find vaild one from cache", cal); > > element = this.locate(cal.locator); > > } > > } > > }else{ > > !tellurium.logManager.isUseLog || fbLog("Trying to locate the UI > > element " + cal.rid + " with its locator " + cal.locator + " because cache > > option is off", cal); > > element = this.locate(cal.locator); > > } > > > if(element == null){ > > fbError("Cannot locate element for uid " + cal.rid + " with locator > > " + cal.locator, element); > > } > > > !tellurium.logManager.isUseLog || fbLog("Returning found UI element ", > > element); > > return element; > > }; > > > On Mon, Mar 22, 2010 at 2:04 PM, dominicm <[email protected]>wrote: > > >> Apologies I hit return when i was still composing the message! To be > >> more specific, this problem only happens if the element doesn't exist > >> on the page. > > >> Not sure if this is a selenium bug or not, but what seems to be > >> happening is that isElementPresent is getting stuck in an infinite > >> loop, presumably because the returned value is null. Exact same tests > >> are fine in FF and googlechrome. I'm using IE8. > > >> Here are snippets from the engine log. > > >> "Issue Bundle Command " > > >> "[{"uid":"mainColumn.pods.largePodContainer[1].events[1].eventName","args": > >> ["jquery=#podsContainer div.Expander:not(.narrow):eq(0) div.podContent > >> > table > tbody > tr:eq(0) > >> td.eventName"],"name":"isElementPresent","sequ":8}]" > >> "Dispatching command: " Object sequ=8 > >> uid="mainColumn.pods.largePodContainer[1 ..." name="isElementPresent" > >> args=[1] > >> "Update argument list for command isElementPresent" Object sequ=8 > >> uid="mainColumn.pods.largePodContainer[1 ..." name="isElementPresent" > >> args=[1] > >> "Command after updating argument list: " Object sequ=8 > >> uid="mainColumn.pods.largePodContainer[1 ..." name="isElementPresent" > >> args=[1] > >> "delegate command to Selenium" Object sequ=8 > >> uid="mainColumn.pods.largePodContainer[1 ..." name="isElementPresent" > >> args=[1] > >> "Delegate Call isElementPresent to Selenium" Object sequ=8 > >> uid="mainColumn.pods.largePodContainer[1 ..." name="isElementPresent" > >> args=[1] > >> "JSON presentation of the cache aware locator: " > > >> "{"rid":"mainColumn.pods.largePodContainer[1].events[1].eventName","locator":"jquery=#podsContainer > >> div.Expander:not(.narrow):eq(0) div.podContent > table > tbody > > >> tr:eq(0) td.eventName"}" > >> "Parsed cache aware locator: " Object > >> rid="mainColumn.pods.largePodContainer[1 ..." > >> locator="jquery=#podsContainer div.Expander: ..." > >> "Tellurium Cache option: " false > >> "Trying to locate the UI element > >> mainColumn.pods.largePodContainer[1].events[1].eventName with its > >> locator jquery=#podsContainer div.Expander:not(.narrow):eq(0) > >> div.podContent > table > tbody > tr:eq(0) td.eventName because cache > >> option is off" Object rid="mainColumn.pods.largePodContainer[1 ..." > >> locator="jquery=#podsContainer div.Expander: ..." > >> >>> console.trace(stack) > >> function"[object Object]"argumentsundefined > >> function"[object Object]"argumentsundefined > >> function"[object Object]"argumentsundefined > >> "Cannot locate element for uid > >> mainColumn.pods.largePodContainer[1].events[1].eventName with locator > >> jquery=#podsContainer div.Expander:not(.narrow):eq(0) div.podContent > > >> table > tbody > tr:eq(0) td.eventName" null > >> "Returning found UI element " null > >> "JSON presentation of the cache aware locator: " > > >> "{"rid":"mainColumn.pods.largePodContainer[1].events[1].eventName","locator":"jquery=#podsContainer > >> div.Expander:not(.narrow):eq(0) div.podContent > table > tbody > > >> tr:eq(0) td.eventName"}" > >> "Parsed cache aware locator: " Object > >> rid="mainColumn.pods.largePodContainer[1 ..." > >> locator="jquery=#podsContainer div.Expander: ..." > >> "Tellurium Cache option: " false > > >> <snip> > > >> "Trying to locate the UI element > >> mainColumn.pods.largePodContainer[1].events[1].eventName with its > >> locator jquery=#podsContainer div.Expander:not(.narrow):eq(0) > >> div.podContent > table > tbody > tr:eq(0) td.eventName because cache > >> option is off" Object rid="mainColumn.pods.largePodContainer[1 ..." > >> locator="jquery=#podsContainer div.Expander: ..." > >> >>> console.trace(stack) > >> function"[object Object]"argumentsundefined > >> function"[object Object]"argumentsundefined > >> function"[object Object]"argumentsundefined > >> "Cannot locate element for uid > >> mainColumn.pods.largePodContainer[1].events[1].eventName with locator > >> jquery=#podsContainer div.Expander:not(.narrow):eq(0) div.podContent > > >> table > tbody > tr:eq(0) td.eventName" null > >> "Returning found UI element " null > >> "Issue Bundle Command " "[{"uid":"","args": > >> [],"name":"isAlertPresent","sequ":9}]" > >> "Dispatching command: " Object sequ=9 uid="" name="isAlertPresent" > >> args=Object > >> "Command after updating argument list: " Object sequ=9 uid="" > >> name="isAlertPresent" args=Object > >> "delegate command to Selenium" Object sequ=9 uid="" > >> name="isAlertPresent" args=Object > >> "Delegate Call isAlertPresent to Selenium" Object sequ=9 uid="" > >> name="isAlertPresent" args=Object > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "tellurium-users" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<tellurium-users%2bunsubscr...@googlegroups.com> > >> . > >> For more options, visit this group at > > ... > > read more »- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en.
