Yes I agree the id in the DOM _should_ be unique, but the team that wrote the app I am testing obviously hasn't had any kind of basic education in how HTML should be used (and this is a purchased product so no real chance of getting this fixed). But I will give the partial matching trick a try next time I trip over this kind of problem.
On 11 May 2010 15:26, Jian Fang <[email protected]> wrote: > Thanks Jonathan. > > The id in the DOM should be unique and id selector is the fastest one. That > is why jQuery > and Tellurium use id only and throw away other parts. > > If you really need to use other attributes, you can try to use partial > matching, i.e., if the ID is "aaa" > you can try "*aaa". Then tellurium will not optimize the generated selector. > > Thanks, > > Jian > > On Tue, May 11, 2010 at 4:07 AM, Jonathan Share <[email protected]> wrote: >> >> I've seen this behaviour several times before and haven't yet set >> aside time to create a reduced test case, but the problem for me has >> been that that the selector used matches more than one html element. >> Note that when you use id in a clocator with CSSSelectors then >> tellurium throws away the definition of the containing elements and >> starts the selector from the element id. >> >> Therefore if you have another element on the page with the id >> saveButton you are probably matching that as well. After noticing this >> behaviour I have begun to avoid using id wherever possible in >> preference for name on form elements. >> >> Hope this helps, >> >> Jonathan >> >> On 11 May 2010 03:15, Jian Fang <[email protected]> wrote: >> > If you use Tellurium 0.7.0, please turn on the Engine log using >> > >> > useEngineLog(true) >> > >> > so that Selenium core will return JavaScript error stack. Also, you can >> > use >> > the >> > firebug or firebug lite bundled in Selenium server 1.0.1-te3 to see the >> > log >> > from console >> > and look at which line caused the problem. >> > >> > Thanks, >> > >> > Jian >> > >> > On Mon, May 10, 2010 at 7:11 PM, super fan 911 <[email protected]> >> > wrote: >> >> >> >> I have the following snippet of HTML code for a pop up window: >> >> >> >> <div id="alertDeleteConfirm" class="popupModalWindow"> >> >> <div class="top"> >> >> <h1>Delete Confirmation</h1> >> >> <a onclick="cancelDelete();return false;" href="#" >> >> class="closeModal">Close</a> >> >> </div> >> >> <div class="main"> >> >> Are you sure you want to delete this?<br> >> >> <br> >> >> <br> >> >> </div> >> >> <div class="actions"><button onclick="confirmDelete();" >> >> id="deleteButton" class="smallPrimary"><span style="text-align: >> >> center;">Delete</span></button> >> >> <button onclick="cancelDelete();return false;" >> >> id="cancelButton" class="smallSecondary"><span>Cancel</span></button> >> >> </div> >> >> </div> >> >> >> >> I have defined the following UI definition: >> >> >> >> ui.Container(uid: "delete_confirmation_popup", clocator: >> >> [tag: >> >> "div", id: "alertDeleteConfirm"]) { >> >> TextBox(uid: "title", clocator: [tag: "h1"]) >> >> UrlLink(uid: "close", cloator: [text: "Close", >> >> class: >> >> "closeModal"]) >> >> TextBox(uid: "message", clocator: [tag: "div", >> >> class: "main"]) >> >> Button(uid: "delete", clocator: [tag: "button", >> >> id: >> >> "saveButton", >> >> class: "smallPrimary"], respond: ["click"]) >> >> Button(uid: "cancel", clocator: [tag: "button", >> >> id: >> >> "cancelButton", >> >> class: "smallSecondary"], respond: ["click"]) >> >> } >> >> >> >> When I do a isElementPresent for all the UI objects, they all return >> >> true. But, when I do a click on 'close', 'delete' they gives me a >> >> selenium error. The 'cancel' works. Below is the selenium stack >> >> trace, >> >> >> >> com.thoughtworks.selenium.SeleniumException: ERROR: Command execution >> >> failure. Please search the forum at http://clearspace.openqa.org for >> >> error details from the log window. The error message is: >> >> element.dispatchEvent is not a function >> >> at >> >> >> >> >> >> com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java: >> >> 97) >> >> at >> >> >> >> >> >> com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java: >> >> 91) >> >> at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite >> >> $PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java: >> >> 229) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java: >> >> 52) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 129) >> >> at >> >> >> >> >> >> org.telluriumsource.component.connector.CustomSelenium.getBundleResponse(CustomSelenium.groovy: >> >> 257) >> >> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1058) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java: >> >> 149) >> >> at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown >> >> Source) >> >> at >> >> >> >> >> >> org.telluriumsource.component.dispatch.Dispatcher.methodMissing(Dispatcher.groovy: >> >> 56) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java: >> >> 813) >> >> at >> >> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java: >> >> 1107) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java: >> >> 39) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 129) >> >> at >> >> >> >> >> >> org.telluriumsource.component.bundle.BundleProcessor.passBundledCommand(BundleProcessor.groovy: >> >> 322) >> >> at org.telluriumsource.component.bundle.BundleProcessor >> >> $passBundledCommand.callCurrent(Unknown Source) >> >> at >> >> >> >> >> >> org.telluriumsource.component.bundle.BundleProcessor.process(BundleProcessor.groovy: >> >> 414) >> >> at org.telluriumsource.component.bundle.BundleProcessor >> >> $process.callCurrent(Unknown Source) >> >> at >> >> >> >> >> >> org.telluriumsource.component.bundle.BundleProcessor.methodMissing(BundleProcessor.groovy: >> >> 427) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java: >> >> 813) >> >> at >> >> groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java: >> >> 1107) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1060) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java: >> >> 39) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 129) >> >> at org.telluriumsource.component.event.EventHandler >> >> $_click_closure6.doCall(EventHandler.groovy:145) >> >> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java: >> >> 273) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java: >> >> 66) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java: >> >> 151) >> >> at org.telluriumsource.component.event.EventHandler >> >> $_click_closure6.doCall(EventHandler.groovy) >> >> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java: >> >> 273) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java: >> >> 39) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 121) >> >> at org.telluriumsource.component.event.EventHandler >> >> $_processEvents_closure1.doCall(EventHandler.groovy:85) >> >> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java: >> >> 273) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at groovy.lang.Closure.call(Closure.java:276) >> >> at groovy.lang.Closure.call(Closure.java:289) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java: >> >> 1176) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java: >> >> 1152) >> >> at org.codehaus.groovy.runtime.dgm$114.invoke(Unknown Source) >> >> at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite >> >> $PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java: >> >> 270) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java: >> >> 52) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 125) >> >> at >> >> >> >> >> >> org.telluriumsource.component.event.EventHandler.processEvents(EventHandler.groovy: >> >> 83) >> >> at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite >> >> $PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java: >> >> 266) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java: >> >> 51) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java: >> >> 44) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java: >> >> 56) >> >> at >> >> >> >> >> >> org.telluriumsource.component.event.EventHandler.click(EventHandler.groovy: >> >> 144) >> >> at org.telluriumsource.component.event.EventHandler >> >> $click.call(Unknown Source) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java: >> >> 40) >> >> at org.telluriumsource.component.event.EventHandler >> >> $click.call(Unknown Source) >> >> at org.telluriumsource.dsl.BaseDslContext >> >> $_click_closure4.doCall(BaseDslContext.groovy:168) >> >> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java: >> >> 273) >> >> at >> >> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java: >> >> 39) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java: >> >> 129) >> >> at >> >> org.telluriumsource.ui.object.UrlLink.click(UrlLink.groovy:26) >> >> at org.telluriumsource.ui.object.UrlLink$click.call(Unknown >> >> Source) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callSafe(AbstractCallSite.java: >> >> 90) >> >> at >> >> org.telluriumsource.dsl.BaseDslContext.click(BaseDslContext.groovy: >> >> 166) >> >> at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite >> >> $PogoCachedMethodSiteNoUnwrap.invoke(PogoMetaMethodSite.java:246) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java: >> >> 51) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java: >> >> 44) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java: >> >> 143) >> >> at >> >> >> >> >> >> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java: >> >> 151) >> >> ... Removed 65 stack frames >> >> >> >> >> >> I need some pointers on how to fix this issue. Thanks in advance! >> >> >> >> >> >> >> >> >> >> -- >> >> 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. >> >> >> > >> > -- >> > 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. >> > >> >> -- >> 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. >> > > -- > 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. > -- 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.
