Link is clearly visible to click If I write
@b.link(:text,'Recharge').click WATIR converts this code into @driver.find_element(:xpath,"//a[normalize-space()='Recharge']").click but this selenium code says that element is not visible, So it's not working. If I write the following selenium code @driver.find_element(:link,'Recharge').click It works properly. Do you understand me now? On Sunday, March 26, 2017 at 3:05:51 PM UTC-7, Titus Fortner wrote: > > Is Watir finding a different link? Or is Selenium just allowing the user > to click a link that is not displayed? > > There are definitely ways that Watir can optimize its locator strategies, > but that part of the code is not trivial to dig into. As always, pull > requests are welcome. > > On Sun, Mar 26, 2017 at 12:18 PM, Raja gopalan <[email protected] > <javascript:>> wrote: > >> >> I have written the following selenium code to click this link >> >> @driver.find_element(:link,'Recharge').click >> >> It successfully clicks the line >> >> >> I have written the same code in WATIR as shown below >> >> >> @b.link(:text,'Recharge').click >> >> >> but it throws element not present error >> >> >> I checked out how this above code works, this above code forms this xpath at >> the end >> >> >> "//a[normalize-space()='Recharge']" >> >> >> So I suspected that this xpath might be the reason, So I have written the >> below selenium code using this xpath, As I expected the same error was >> >> thrown by selenium as well(element is not visible) >> >> >> @driver.find_element(:xpath,"//a[normalize-space()='Recharge']").click >> >> So what I think is, WATIR should refrain forming the xpath when b.link is >> called, they can directly convert this code to >> @driver.find_element(:link,'Recharge') but they >> >> can form the xpath when b.element(:text,'Recharge') is called >> >> >> any suggestion? >> >> >> -- >> -- >> 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.
