IOr what about just doing something of the form browser.link(:text, "Main)
since that appears to be the text associated with the link tag Either one (by URL as Ethan gave, or text as above) is clearer and more direct (and likely faster) than xpath Xpath is good for somethings, but it is not always the best tool for the job. (nor does it tend to create readable test code where convoluted paths are involved.) Be a craftsmen, learn to use more than one tool, and learn to use the right tool for the job. It's like someone handed you a hammer named 'xpath' and you are trying to treat every problem around you like a nail (including screws, nuts and bolts, etc) and your solution is to wack it with that one hammer. Frankly given the way you are approaching this, I think a number of folks here are feeling pretty sorry for snapfish On Aug 19, 9:24 am, Ethan <notet...@gmail.com> wrote: > I don't think there's anything wrong with xpath. > However, you are using #cell, which looks for a table cell, but specifying > tag <a> which is a link. You won't find an element that is both a table cell > and a link. > ie.link(:xpath, '//a...@href=whatever]') > > > > On Thu, Aug 19, 2010 at 12:10, Eric Mathiesen <mathiese...@gmail.com> wrote: > > What are you so insistent on using x-path? That is probably the worst way > > to achieve what you are after, several people have agreed with this > > statement, yet you continue doing it. I just don't understand. > > > Eric > > > On Thu, Aug 19, 2010 at 8:33 AM, goutham mandadi < > > goutham.mand...@gmail.com> wrote: > > >> ie.cell(:xpath,"//a...@href=' > >>http://www.snapfish.com/snapfish/youraccount']/<http://www.snapfish.com/snapfish/youraccount%27%5D/> > >> ").click > >> sorry > >> thanks, > >> goutham > > >> On Thu, Aug 19, 2010 at 9:01 PM, goutham mandadi < > >> goutham.mand...@gmail.com> wrote: > > >>> hai ethan thanks a lot its working now i used :href inside area bt when > >>> using :xpath i am getting the following error > > >>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:56:in > >>> `assert_exists': Unable to locate element, using :xpath, "//a[href=' > >>>http://www.snapfish.com/snapfish/youraccount'<http://www.snapfish.com/snapfish/youraccount%27>]" > >>> (Watir::Exception::UnknownObjectException) > >>> from > >>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:288:in > >>> `enabled?' > >>> from > >>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:60:in > >>> `assert_enabled' > >>> from > >>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:233:in > >>> `click!' > >>> from > >>> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/element.rb:219:in > >>> `click' > >>> this is the element i am trying to click on > >>> <td><a > >>> href="http://www.snapfish.com/snapfish/youraccount">Main<http://www.snapfish.com/snapfish/youraccount%22%3EMain>account > >>> page</a></td> > > >>> this is the codei have written > >>> Can anyone help me on this > > >>> Thanks, > >>> Goutham > >>> On Wed, Aug 18, 2010 at 11:21 PM, Ethan <notet...@gmail.com> wrote: > > >>>> I don't think that you should be using element_by_xpath at all. It does > >>>> not return a Watir::Element. You should use a normal element accessor > >>>> with > >>>> the :xpath specifier: > >>>> ie.area(:xpath, "//whatever/").click > > >>>> On Wed, Aug 18, 2010 at 13:18, goutham mandadi < > >>>> goutham.mand...@gmail.com> wrote: > > >>>>> Hai charley, > > >>>>> I ahev installed from gems C:\ruby\lib\ruby\gems\1.8\gems in this path > >>>>> i am having commonwatir-1.6.5 and firewatir-1.6.5 and watir-1.6.5 > >>>>> folders > >>>>> when i run from this path i am getting th following error > > >>>>> one.rb:7: undefined method `click' for nil:NilClass (NoMethodError) > >>>>> require 'watir' > >>>>> ie = Watir::IE.start("http://www.snapfish.com/login") > >>>>> ie.text_field(:name, "emailaddress").set(" > >>>>> goutham.mand...@valuelabs.net") > >>>>> ie.text_field(:name, "password").set("sfqatest") > >>>>> ie.button(:name, "log in").click > >>>>> ie.element_by_xpath("//ar...@href=' > >>>>> www5.snapfish.com/snapfish/youraccount'<http://www5.snapfish.com/snapfish/youraccount%27> > >>>>> ]").click > > >>>>> waht might be the reason for this anyone help me > > >>>>> Thankyou, > >>>>> Goutham > > >>>>> this is code i am using > >>>>> On Tue, Aug 17, 2010 at 10:52 PM, Charley Baker < > >>>>> charley.ba...@gmail.com> wrote: > > >>>>>> Shouldn't be in site_ruby, that's gotta be version 1.4.1 with the > >>>>>> Watir installer. Uninstall that and make sure you're reinstall the > >>>>>> Watir > >>>>>> gem, worst case wipe the ruby directory and install the latest Watir > >>>>>> gem, > >>>>>> should be 1.6.5 and run from the gem directory, not site_ruby. > > >>>>>> Charley Baker > >>>>>> Lead Developer, Watir,http://watir.com > > >>>>>> On Tue, Aug 17, 2010 at 11:08 AM, goutham mandadi < > >>>>>> goutham.mand...@gmail.com> wrote: > > >>>>>>> Hai, > > >>>>>>> c:/ruby/lib/ruby/site_ruby/1.8/watir.rb this is path from which it is > >>>>>>> executing here in watir.rb i couldnot find method element_by_xpath > >>>>>>> how to add this > > >>>>>>> thanks, > >>>>>>> goutham > > >>>>>>> On Tue, Aug 17, 2010 at 9:08 PM, goutham mandadi < > >>>>>>> goutham.mand...@gmail.com> wrote: > > >>>>>>>> Hi eric, > > >>>>>>>> I did not get you what are orb and .flash i am new to watir > > >>>>>>>> Thanks, > >>>>>>>> Goutham > > >>>>>>>> On Tue, Aug 17, 2010 at 8:58 PM, Eric Mathiesen < > >>>>>>>> mathiese...@gmail.com> wrote: > > >>>>>>>>> You could also use orb and .flash the index. > > >>>>>>>>> On Aug 17, 2010 8:23 AM, "goutham mandadi" < > >>>>>>>>> goutham.mand...@gmail.com> wrote: > > >>>>>>>>> Hai Chuck, > > >>>>>>>>> Thanks for ur reply we can add id or name for this element but why > >>>>>>>>> is element by xpath is not working for me can u help me on this > > >>>>>>>>> Thankyou, > >>>>>>>>> Goutham > > >>>>>>>>> On Tue, Aug 17, 2010 at 8:48 PM, Chuck van der Linden < > >>>>>>>>> sqa...@gmail.com> wrote: > > As an alternativ... > > >>>>>>>>> -- > >>>>>>>>> Before posting, please readhttp://watir.com/support. In short: > >>>>>>>>> search before you ask, be nice. > > >>>>>>>>> You received this message because you are subscribed to > >>>>>>>>>http://groups.google.com/group/watir-general > >>>>>>>>> To post: watir-general@googlegroups.com > >>>>>>>>> To unsubscribe: > >>>>>>>>> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >>>>>>>>> legroups.com> > > >>>>>>> -- > >>>>>>> Before posting, please readhttp://watir.com/support. In short: > >>>>>>> search before you ask, be nice. > > >>>>>>> You received this message because you are subscribed to > >>>>>>>http://groups.google.com/group/watir-general > >>>>>>> To post: watir-general@googlegroups.com > >>>>>>> To unsubscribe: > >>>>>>> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >>>>>>> legroups.com> > > >>>>>> -- > >>>>>> Before posting, please readhttp://watir.com/support. In short: > >>>>>> search before you ask, be nice. > > >>>>>> You received this message because you are subscribed to > >>>>>>http://groups.google.com/group/watir-general > >>>>>> To post: watir-general@googlegroups.com > >>>>>> To unsubscribe: > >>>>>> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >>>>>> legroups.com> > > >>>>> -- > >>>>> Before posting, please readhttp://watir.com/support. In short: search > >>>>> before you ask, be nice. > > >>>>> You received this message because you are subscribed to > >>>>>http://groups.google.com/group/watir-general > >>>>> To post: watir-general@googlegroups.com > >>>>> To unsubscribe: > >>>>> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >>>>> legroups.com> > > >>>> -- > >>>> Before posting, please readhttp://watir.com/support. In short: search > >>>> before you ask, be nice. > > >>>> You received this message because you are subscribed to > >>>>http://groups.google.com/group/watir-general > >>>> To post: watir-general@googlegroups.com > >>>> To unsubscribe: > >>>> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >>>> legroups.com> > > >> -- > >> Before posting, please readhttp://watir.com/support. In short: search > >> before you ask, be nice. > > >> You received this message because you are subscribed to > >>http://groups.google.com/group/watir-general > >> To post: watir-general@googlegroups.com > >> To unsubscribe: > >> watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > >> legroups.com> > > > -- > > Before posting, please readhttp://watir.com/support. In short: search > > before you ask, be nice. > > > You received this message because you are subscribed to > >http://groups.google.com/group/watir-general > > To post: watir-general@googlegroups.com > > To unsubscribe: > > watir-general+unsubscr...@googlegroups.com<watir-general%2bunsubscr...@goog > > legroups.com> -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. You received this message because you are subscribed to http://groups.google.com/group/watir-general To post: watir-general@googlegroups.com To unsubscribe: watir-general+unsubscr...@googlegroups.com