> > You have more than one iframe with an id of 'SearchPanel' on the same > page?
yes, Exactly, I have three frame with an id of 'SearchPanel'. And yes, you can build this with Watir API without using XPath here it is @b.element(id: 'ApprovalManagerSearch').following_siblings[1].iframe(id: 'SearchPanel').element(:id, "adviser1").click But that could be helpful for the beginner, because I don't want to give the extra work to WATIR when I am able to write the xpath. On Thursday, December 14, 2017 at 12:55:03 AM UTC+5:30, Titus Fortner wrote: > You have more than one iframe with an id of 'SearchPanel' on the same > page? > > And yes, you can build this with Watir API without using XPath > > On Wed, Dec 13, 2017 at 7:23 PM, <[email protected] <javascript:>> > wrote: > > I am saying WATIR forms the xpath internally when you pass a locator > which > > is not of selenium, for an example, text: locator > > > > If you write a code > > > > b.span(text: 'something').click > > > > > > then WATIR would write the corresponding equivalent as below > > > > driver.find_element(xpath: "//span[normalize-space()='something']).clici > > > > > > > > It's not possible to locate element without xpath in some places, xpath > is > > pretty important and also unlike watir-classic, new WATIR which uses > > selenium-webdriver does the exceptional job with xpath. I have written > an > > xpath when I code yesterday for an insurance company > > > > @b.element(xpath: > > > ".//*[@id='ApprovalManagerSearch']/following-sibling::div[1]").iframe(id: > > 'SearchPanel').element(:id, "adviser1").click > > > > You see, you can't locate this element without using xpath and ofcourse > > watir provides functions to form this xpath, but that's for beginners, > not > > for the one who learnt very well. > > > > > > > > > > On Wednesday, December 13, 2017 at 10:53:18 PM UTC+5:30, Chuck van der > > Linden wrote: > >> > >> On Tuesday, December 12, 2017 at 9:56:46 AM UTC-8, rajagopalan madasami > >> wrote: > >>> > >>> I am using watir over selenium for two reasons, one reason is waiting > >>> timings are maintained by local language binding but selenium is > maintaining > >>> timing from driver level , since selenium uses the timing from driver > level > >>> it differs from Firefox to Chrome, but since WATIR is maintaining > timing > >>> from local language binding it doesn't matter whether I use Chrome or > >>> Firefox. Another reason is stale element problem, WATIR relocates the > >>> element when element goes to stale other than that I don't use any > other > >>> features of WATIR because everything else is time consuming like xpah > >>> formation. So if you simply allow element () to access selenium > locators > >>> directly it would be useful for me rather than unnecessary deprecating > what > >>> word extraordinary. > >>>> > >>>> > >> When you say xpath formation, are you referring to figuring out xpath > to > >> use for selecting elements, or something internal to the code? > >> > >> I'm a bit surprised if the first as I almost never use xpath, in fact I > >> avoid it, when selecting elements, I'm nearly always using something > like > >> ID, or Name, or Data-something, or Class , or increasingly of late CSS > >> selectors (whatever allows me to uniquely locate the element(s) I > need). > >> For me the main objective is clear readable code which is as > non-brittle as > >> possible. So for something like the makemytrip site I'd be selecting > >> things such as > >> > >> browser.text_field(id: "hp-widget__sTo") > >> > >> > >> > > > > -- > > -- > > Before posting, please read http://watir.com/support. In short: search > > before you ask, be nice. > > > > [email protected] <javascript:> > > http://groups.google.com/group/watir-general > > [email protected] <javascript:> > > > > --- > > You received this message because you are subscribed to the Google > Groups > > "Watir General" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
