I think that this is the default behavior of IE and there's nothing we can do really. Or is there? Jari, remind me, how watir-webdriver works in that situation. I remember that there was the exact same problem.
Jarmo On Fri, Apr 15, 2011 at 8:58 AM, Alok Menghrajani <a...@fb.com> wrote: > Hi all, > > It seems IE & firefox don't deal with relative paths in the same way. > > Given the following page: > <html> > <body> > <a href="/foo.html">hello</a> > </body> > </html> > > Here is a comparison of various ways to get the link: > > On IE 8: > - Ie fails with: browser.link(:href, '/foo.html').exists? > > - Ie works with: browser.link(:href, /foo.html/).exists? > > - Ie works with: browser.link(:xpath, "//a[@href='/foo.html']").exists? > > - Ie fails with: browser.element(:xpath, "//a[@href='/foo.html']").exists? > Watir::Exception::MissingWayOfFindingObjectException: xpath is an > unknown way of > finding a <*> element (//a[@href='/foo.html']) > > - Ie fails with: browser.element_by_xpath("//a[@href='/foo.html']").exists? > WIN32OLERuntimeError: unknown property or method `exists?' > HRESULT error code:0x80020006 > Unknown name. > > > On Firefox: > - firwfox works with: browser.link(:href, '/foo.html').exists? > > - firefox works with: browser.link(:href, /foo.html/).exists? > > - firefox works with: browser.link(:xpath, > "//a[@href='/foo.html']").exists? > > - firefox fails with: browser.element(:xpath, > "//a[@href='/foo.html']").exists? > NoMethodError: undefined method `element' for > #<FireWatir::Firefox:0x1015426d8> > > - firefox works with: > browser.element_by_xpath("//a[@href='/foo.html']").exists? > > > > It seems like IE converts the relative url into absolute (at least that's > what I'm seeing when I do browser.link(:href, /foo.html).to_s. Is there > any easy way to get the original relative url? It would be nice to fix the > behavior to be consistent across browsers :) > > I do have a unittest for all this. Should I put it in watir/unittests or > commonwatir/unittests ? > > Alok > > _______________________________________________ > Wtr-development mailing list > Wtr-development@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-development >
_______________________________________________ Wtr-development mailing list Wtr-development@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-development