Would it work to use just a fragment of the onclick value?  If so, you can
try locating the element using XPath string functions like this:

ie.link(:xpath, "//a[starts-with(@onclick, 'dijit')]").click

ie.link(:xpath, "//a[contains(@onclick, 'taskId=6')]").click

I may be missing a less complicated way to do this, though. :)

Thanks
Bill


On Tue, Sep 29, 2009 at 6:55 PM, bert <[email protected]> wrote:

>
> Thanks in advance!
>
> I am trying to click on the following element using xpath by
> referencing its unique onclick property:
>
> <a onclick="dijit.byId('queryDetail').href='DISPLAY-QUERY-SUMMARY.do?
> taskId=6&type=details'; dijit.byId('queryDetail').show(); return
> false;" href="">details</a>
>
> I have tried several of the following and not sure what Im doing
> wrong.  I keep getting a "NoMethodError: undefined method `click' for
> nil:NilClass".  As you can see the onclick property has various
> apostrophes, ampersand, etc.  Not sure if this is the cause of my
> troubles.
>
> I have tried:
>
> @browser.element_by_xpath("//a...@onclick='dijit.byId(\'queryDetail
> \').href=\'DISPLAY-QUERY-SUMMARY.do?taskId=6\&type=details\';
> dijit.byId(\'queryDetail\').show(); return false;']").click
>
> @browser.element_by_xpath("//a...@onclick='dijit.byId
> ('queryDetail').href='DISPLAY-QUERY-SUMMARY.do?
> taskId=0&type=sql'; dijit.byId('queryDetail').show
> (); return false;']").click() pos;).show
> (); return false;']").click()
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to