Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Yes, WATIR manages extremely well! On Wednesday, March 29, 2017 at 7:13:36 AM UTC-7, Titus Fortner wrote: > > Yes, we discussed some of the peculiarities with matching strings and > regex a couple years ago: https://github.com/watir/watir/issues/342 > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Yes, we discussed some of the peculiarities with matching strings and regex a couple years ago: https://github.com/watir/watir/issues/342 -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Titus, I just noticed that watir handled that possibility when I write b.element(:link,'Recharge').click The following succeeds because selenium finder includes :link. if WD_FINDERS.include?(how) how, what = @selector.to_a.first selector_builder.check_type(how, what) if WD_FINDERS.include?(how) wd_find_first_by(how, what) else find_first_by_multiple end On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: > > Apparently you included the link in an earlier post that I missed. It does > look like Watir is grabbing a different, hidden element. I'll try to take a > longer look at it tonight. > > Titus > > On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: >> >> hi, sorry, that was not done properly, here is the html file >> >> >> >> >> >> >> >> >> >> >> >> Recharge >> >> >> >> >> >> >> >> >> >> >> >> On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: >>> >>> This html doesn't have any links with text equal to "Recharge" >>> >>> >>> On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: Here is the Html code Pay Bill >>> > Savings Account http://schema.org/WebSite"; itemscope=""> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35987772-1']); _gaq.push(['_setDomainName', 'airtel.in']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' airtel.in']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; //ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + ' stats.g.doubleclick.net/dc.js'; ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: > > I'd need to see the html to see why it works for one of the locator > strategies, but not the other. > > On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan > wrote: > >> Here is the code >> >> >> >> require 'watir' >> class AirTelRecharge >> def initialize >> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: >> false) >> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: >> "default" >> @b.goto "https://www.airtel.in/"; >> @driver=@b.driver >> @driver.manage.timeouts.implicit_wait=10 >> end >> >> def execute >> @b.element(:text, 'Pay & Recharge').click >> @driver.find_element(:link,'Recharge').click #Here is the problem >> this code doesn't work for @b.element(:text,'Recharge').click >> end >> end >> >> AirTelRecharge.new.execute >> >> >> >> On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >>> >>> Those two locators should find the same element, but it appears it >>> is not if one says the element exists but is not visible and the other >>> says >>> it is visible. To figure out why it is finding a different element, I'd >>> need to see the underlying html. >>> >>> >>> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: 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 opti
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Continuing to my previous reply Okay, I just found b.element(:link,'Recharge').click does that Job. On Tuesday, March 28, 2017 at 1:49:25 PM UTC-7, Justin Ko wrote: > > The difference appears to be that `b.link(:text, 'Recharge')` includes > hidden links, where as `driver.find_element(:link, 'Recharge')` only > includes visible links. > > The page includes 8 links with the matching text: > > "javascript:void(0);">Recharge > > Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings > Account > Manage Account > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > > Transact > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings > Account > Manage Account > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > > Transact > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common">Recharge > target="_self" href="https://www.airtel.in/netbanking/payments-recharges"; > data-i18n="recharge" module-id="common">Recharge > > However, only the 2nd one, which is the one you want, is visible: > > b.links(:text, 'Recharge').map(&:visible?) > #=> [false, true, false, false, false, false, false, false] > > You get an exception in Watir because it is clicking on the first one, > which is hidden. You could simulate what Selenium is doing by adding the > visible locator: > > b.link(text: 'Recharge', visible: true).click > > Justin > > > On Tuesday, March 28, 2017 at 12:41:35 PM UTC-4, Raja gopalan wrote: >> >> This is the link "https://www.airtel.in/"; once you entered, please click >> "PAY & RECHARGE" then you will have Recharge option. >> >> >> On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: >>> >>> Apparently you included the link in an earlier post that I missed. It >>> does look like Watir is grabbing a different, hidden element. I'll try to >>> take a longer look at it tonight. >>> >>> Titus >>> >>> On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: hi, sorry, that was not done properly, here is the html file Recharge On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: > > This html doesn't have any links with text equal to "Recharge" > > > On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: >> >> Here is the Html code >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >Pay Bill >> >> >> >> >> >> >> >> >> >> >> >> > > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Savings Account >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://schema.org/WebSite"; itemscope=""> >> >> >> >> >> >> >> >> >> >> >> >> >> >> var _gaq = _gaq || []; >> _gaq.push(['_setAccount', 'UA-35987772-1']); >> _gaq.push(['_setDomainName', 'airtel.in']); >> _gaq.push(['_setAllowLinker', true]); >> _gaq.push(['_setAllowAnchor', true]); >> _gaq.push(['_addIgnoredRef', ' >> airtel.in']); _gaq.push(['_trackPageview']); (function() { >> var ga = document.createElement('script'); ga.type = >> 'text/javascript'; ga.async = true; >> //ga.src = ('https:' == document.location.protocol ? 'https://' : >> 'http://') + ' >> stats.g.doubleclick.net/dc.js'; >> ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); >> var s = document.getElementsByTagName('script')[0]; >> s.parentNode.insertBefore(ga, s); >> })(); >> >> >> >> >> >> On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: >>> >>> I'd need to see the html to see why it works for one of the locator >>> strategies, but not the other. >>> >>> On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan >> > wrote: >>> Here is the co
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Ah! Okay, The difference appears to be that `b.link(:text, 'Recharge')` includes hidden links, where as `driver.find_element(:link, 'Recharge')` only includes visible links. Then that's the bug then in WATIR, why not WATIR directly convert this line b.link(:text,'Recharge') into driver.find_element(:link,'Recharge') And when we write b.element(:text,'Recharge') into driver.find_element(:xpath,"//*[normalize-space()='Rechage']") That would be more appropriate,right? On Tuesday, March 28, 2017 at 1:49:25 PM UTC-7, Justin Ko wrote: > > The difference appears to be that `b.link(:text, 'Recharge')` includes > hidden links, where as `driver.find_element(:link, 'Recharge')` only > includes visible links. > > The page includes 8 links with the matching text: > > "javascript:void(0);">Recharge > > Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings > Account > Manage Account > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > > Transact > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings > Account > Manage Account > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > > Transact > Recharge')">Recharge > https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" > module-id="common">Recharge > target="_self" href="https://www.airtel.in/netbanking/payments-recharges"; > data-i18n="recharge" module-id="common">Recharge > > However, only the 2nd one, which is the one you want, is visible: > > b.links(:text, 'Recharge').map(&:visible?) > #=> [false, true, false, false, false, false, false, false] > > You get an exception in Watir because it is clicking on the first one, > which is hidden. You could simulate what Selenium is doing by adding the > visible locator: > > b.link(text: 'Recharge', visible: true).click > > Justin > > > On Tuesday, March 28, 2017 at 12:41:35 PM UTC-4, Raja gopalan wrote: >> >> This is the link "https://www.airtel.in/"; once you entered, please click >> "PAY & RECHARGE" then you will have Recharge option. >> >> >> On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: >>> >>> Apparently you included the link in an earlier post that I missed. It >>> does look like Watir is grabbing a different, hidden element. I'll try to >>> take a longer look at it tonight. >>> >>> Titus >>> >>> On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: hi, sorry, that was not done properly, here is the html file Recharge On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: > > This html doesn't have any links with text equal to "Recharge" > > > On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: >> >> Here is the Html code >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >Pay Bill >> >> >> >> >> >> >> >> >> >> >> >> > > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Savings Account >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://schema.org/WebSite"; itemscope=""> >> >> >> >> >> >> >> >> >> >> >> >> >> >> var _gaq = _gaq || []; >> _gaq.push(['_setAccount', 'UA-35987772-1']); >> _gaq.push(['_setDomainName', 'airtel.in']); >> _gaq.push(['_setAllowLinker', true]); >> _gaq.push(['_setAllowAnchor', true]); >> _gaq.push(['_addIgnoredRef', ' >> airtel.in']); _gaq.push(['_trackPageview']); (function() { >> var ga = document.createElement('script'); ga.type = >> 'text/javascript'; ga.async = true; >> //ga.src = ('https:' == document.location.protocol ? 'https://' : >> 'http://') + ' >> stats.g.doubleclick.net/dc.js'; >> ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); >> var s = document.getElementsByTagName('script')[0]; >> s.parentNode.insertB
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
The difference appears to be that `b.link(:text, 'Recharge')` includes hidden links, where as `driver.find_element(:link, 'Recharge')` only includes visible links. The page includes 8 links with the matching text: Recharge Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings Account > Manage Account > Recharge')">Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > Transact > Recharge')">Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common" onclick="setCookie('headerlink','Bank WithUs> Savings Account > Manage Account > Recharge')">Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common" onclick="setCookie('headerlink','Bank WithUs> Wallet > Transact > Recharge')">Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common">Recharge https://www.airtel.in/netbanking/payments-recharges"; data-i18n="recharge" module-id="common">Recharge However, only the 2nd one, which is the one you want, is visible: b.links(:text, 'Recharge').map(&:visible?) #=> [false, true, false, false, false, false, false, false] You get an exception in Watir because it is clicking on the first one, which is hidden. You could simulate what Selenium is doing by adding the visible locator: b.link(text: 'Recharge', visible: true).click Justin On Tuesday, March 28, 2017 at 12:41:35 PM UTC-4, Raja gopalan wrote: > > This is the link "https://www.airtel.in/"; once you entered, please click "PAY > & RECHARGE" then you will have Recharge option. > > > On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: >> >> Apparently you included the link in an earlier post that I missed. It >> does look like Watir is grabbing a different, hidden element. I'll try to >> take a longer look at it tonight. >> >> Titus >> >> On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: >>> >>> hi, sorry, that was not done properly, here is the html file >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Recharge >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: This html doesn't have any links with text equal to "Recharge" On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: > > Here is the Html code > > > > > > > > > > > > > > > > > > > > > > > > Pay Bill > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Savings Account > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://schema.org/WebSite"; itemscope=""> > > > > > > > > > > > > > > var _gaq = _gaq || []; > _gaq.push(['_setAccount', 'UA-35987772-1']); > _gaq.push(['_setDomainName', 'airtel.in']); > _gaq.push(['_setAllowLinker', true]); > _gaq.push(['_setAllowAnchor', true]); > _gaq.push(['_addIgnoredRef', ' > airtel.in']); _gaq.push(['_trackPageview']); (function() { > var ga = document.createElement('script'); ga.type = > 'text/javascript'; ga.async = true; > //ga.src = ('https:' == document.location.protocol ? 'https://' : > 'http://') + ' > stats.g.doubleclick.net/dc.js'; > ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); > var s = document.getElementsByTagName('script')[0]; > s.parentNode.insertBefore(ga, s); > })(); > > > > > > On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: >> >> I'd need to see the html to see why it works for one of the locator >> strategies, but not the other. >> >> On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan >> wrote: >> >>> Here is the code >>> >>> >>> >>> require 'watir' >>> class AirTelRecharge >>> def initialize >>> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette >>> : false) >>> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile >>> : "default" >>> @b.goto "https://www.airtel.in/"; >>> @driver=@b.driver >>> @driver.manage.timeouts.implicit_wait=10 >>> end >>> >>> def execute >>> @b.element
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
This is the link "https://www.airtel.in/"; once you entered, please click "PAY & RECHARGE" then you will have Recharge option. On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: > > Apparently you included the link in an earlier post that I missed. It does > look like Watir is grabbing a different, hidden element. I'll try to take a > longer look at it tonight. > > Titus > > On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: >> >> hi, sorry, that was not done properly, here is the html file >> >> >> >> >> >> >> >> >> >> >> >> Recharge >> >> >> >> >> >> >> >> >> >> >> >> On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: >>> >>> This html doesn't have any links with text equal to "Recharge" >>> >>> >>> On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: Here is the Html code Pay Bill >>> > Savings Account http://schema.org/WebSite"; itemscope=""> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35987772-1']); _gaq.push(['_setDomainName', 'airtel.in']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' airtel.in']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; //ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + ' stats.g.doubleclick.net/dc.js'; ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: > > I'd need to see the html to see why it works for one of the locator > strategies, but not the other. > > On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan > wrote: > >> Here is the code >> >> >> >> require 'watir' >> class AirTelRecharge >> def initialize >> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: >> false) >> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: >> "default" >> @b.goto "https://www.airtel.in/"; >> @driver=@b.driver >> @driver.manage.timeouts.implicit_wait=10 >> end >> >> def execute >> @b.element(:text, 'Pay & Recharge').click >> @driver.find_element(:link,'Recharge').click #Here is the problem >> this code doesn't work for @b.element(:text,'Recharge').click >> end >> end >> >> AirTelRecharge.new.execute >> >> >> >> On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >>> >>> Those two locators should find the same element, but it appears it >>> is not if one says the element exists but is not visible and the other >>> says >>> it is visible. To figure out why it is finding a different element, I'd >>> need to see the underlying html. >>> >>> >>> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: 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 < > rajagopa...@g
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
This is the link "https://www.airtel.in/"; once you entered, please click "PAY & RECHARGE" then you will have Recharge option. On Tuesday, March 28, 2017 at 9:34:08 AM UTC-7, Titus Fortner wrote: > > Apparently you included the link in an earlier post that I missed. It does > look like Watir is grabbing a different, hidden element. I'll try to take a > longer look at it tonight. > > Titus > > On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: >> >> hi, sorry, that was not done properly, here is the html file >> >> >> >> >> >> >> >> >> >> >> >> Recharge >> >> >> >> >> >> >> >> >> >> >> >> On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: >>> >>> This html doesn't have any links with text equal to "Recharge" >>> >>> >>> On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: Here is the Html code Pay Bill >>> > Savings Account http://schema.org/WebSite"; itemscope=""> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35987772-1']); _gaq.push(['_setDomainName', 'airtel.in']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' airtel.in']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; //ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + ' stats.g.doubleclick.net/dc.js'; ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: > > I'd need to see the html to see why it works for one of the locator > strategies, but not the other. > > On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan > wrote: > >> Here is the code >> >> >> >> require 'watir' >> class AirTelRecharge >> def initialize >> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: >> false) >> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: >> "default" >> @b.goto "https://www.airtel.in/"; >> @driver=@b.driver >> @driver.manage.timeouts.implicit_wait=10 >> end >> >> def execute >> @b.element(:text, 'Pay & Recharge').click >> @driver.find_element(:link,'Recharge').click #Here is the problem >> this code doesn't work for @b.element(:text,'Recharge').click >> end >> end >> >> AirTelRecharge.new.execute >> >> >> >> On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >>> >>> Those two locators should find the same element, but it appears it >>> is not if one says the element exists but is not visible and the other >>> says >>> it is visible. To figure out why it is finding a different element, I'd >>> need to see the underlying html. >>> >>> >>> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: 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 < > rajagopa...@g
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Apparently you included the link in an earlier post that I missed. It does look like Watir is grabbing a different, hidden element. I'll try to take a longer look at it tonight. Titus On Tuesday, March 28, 2017 at 11:24:16 AM UTC-5, Raja gopalan wrote: > > hi, sorry, that was not done properly, here is the html file > > > > > > > > > > > > Recharge > > > > > > > > > > > > On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: >> >> This html doesn't have any links with text equal to "Recharge" >> >> >> On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: >>> >>> Here is the Html code >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Pay Bill >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Savings Account >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> http://schema.org/WebSite"; itemscope=""> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> var _gaq = _gaq || []; >>> _gaq.push(['_setAccount', 'UA-35987772-1']); >>> _gaq.push(['_setDomainName', 'airtel.in']); >>> _gaq.push(['_setAllowLinker', true]); >>> _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' >>> airtel.in']); _gaq.push(['_trackPageview']); (function() { >>> var ga = document.createElement('script'); ga.type = >>> 'text/javascript'; ga.async = true; >>> //ga.src = ('https:' == document.location.protocol ? 'https://' : >>> 'http://') + ' >>> stats.g.doubleclick.net/dc.js'; >>> ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); >>> var s = document.getElementsByTagName('script')[0]; >>> s.parentNode.insertBefore(ga, s); >>> })(); >>> >>> >>> >>> >>> >>> On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: I'd need to see the html to see why it works for one of the locator strategies, but not the other. On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan wrote: > Here is the code > > > > require 'watir' > class AirTelRecharge > def initialize > caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: > false) > @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: > "default" > @b.goto "https://www.airtel.in/"; > @driver=@b.driver > @driver.manage.timeouts.implicit_wait=10 > end > > def execute > @b.element(:text, 'Pay & Recharge').click > @driver.find_element(:link,'Recharge').click #Here is the problem > this code doesn't work for @b.element(:text,'Recharge').click > end > end > > AirTelRecharge.new.execute > > > > On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >> >> Those two locators should find the same element, but it appears it is >> not if one says the element exists but is not visible and the other says >> it >> is visible. To figure out why it is finding a different element, I'd >> need >> to see the underlying html. >> >> >> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: >>> >>> 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 < rajagopa...@gmail.com> 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 > >
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
hi, sorry, that was not done properly, here is the html file Recharge On Monday, March 27, 2017 at 9:32:57 PM UTC-7, Titus Fortner wrote: > > This html doesn't have any links with text equal to "Recharge" > > > On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: >> >> Here is the Html code >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Pay Bill >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Savings Account >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://schema.org/WebSite"; itemscope=""> >> >> >> >> >> >> >> >> >> >> >> >> >> >> var _gaq = _gaq || []; >> _gaq.push(['_setAccount', 'UA-35987772-1']); >> _gaq.push(['_setDomainName', 'airtel.in']); >> _gaq.push(['_setAllowLinker', true]); >> _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' >> airtel.in']); _gaq.push(['_trackPageview']); (function() { >> var ga = document.createElement('script'); ga.type = 'text/javascript'; >> ga.async = true; >> //ga.src = ('https:' == document.location.protocol ? 'https://' : >> 'http://') + ' >> stats.g.doubleclick.net/dc.js'; >> ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); >> var s = document.getElementsByTagName('script')[0]; >> s.parentNode.insertBefore(ga, s); >> })(); >> >> >> >> >> >> On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: >>> >>> I'd need to see the html to see why it works for one of the locator >>> strategies, but not the other. >>> >>> On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan >>> wrote: >>> Here is the code require 'watir' class AirTelRecharge def initialize caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false) @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: "default" @b.goto "https://www.airtel.in/"; @driver=@b.driver @driver.manage.timeouts.implicit_wait=10 end def execute @b.element(:text, 'Pay & Recharge').click @driver.find_element(:link,'Recharge').click #Here is the problem this code doesn't work for @b.element(:text,'Recharge').click end end AirTelRecharge.new.execute On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: > > Those two locators should find the same element, but it appears it is > not if one says the element exists but is not visible and the other says > it > is visible. To figure out why it is finding a different element, I'd need > to see the underlying html. > > > On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: >> >> 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 < >>> rajagopa...@gmail.com> 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
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
This html doesn't have any links with text equal to "Recharge" On Monday, March 27, 2017 at 11:13:03 PM UTC-5, Raja gopalan wrote: > > Here is the Html code > > > > > > > > > > > > > > > > > > > > > > > > Pay Bill > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Savings Account > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://schema.org/WebSite"; itemscope=""> > > > > > > > > > > > > > > var _gaq = _gaq || []; > _gaq.push(['_setAccount', 'UA-35987772-1']); > _gaq.push(['_setDomainName', 'airtel.in']); > _gaq.push(['_setAllowLinker', true]); > _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', ' > airtel.in']); _gaq.push(['_trackPageview']); (function() { > var ga = document.createElement('script'); ga.type = 'text/javascript'; > ga.async = true; > //ga.src = ('https:' == document.location.protocol ? 'https://' : > 'http://') + ' > stats.g.doubleclick.net/dc.js'; > ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); > var s = document.getElementsByTagName('script')[0]; > s.parentNode.insertBefore(ga, s); > })(); > > > > > > On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: >> >> I'd need to see the html to see why it works for one of the locator >> strategies, but not the other. >> >> On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan >> wrote: >> >>> Here is the code >>> >>> >>> >>> require 'watir' >>> class AirTelRecharge >>> def initialize >>> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: >>> false) >>> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: >>> "default" >>> @b.goto "https://www.airtel.in/"; >>> @driver=@b.driver >>> @driver.manage.timeouts.implicit_wait=10 >>> end >>> >>> def execute >>> @b.element(:text, 'Pay & Recharge').click >>> @driver.find_element(:link,'Recharge').click #Here is the problem this >>> code doesn't work for @b.element(:text,'Recharge').click >>> end >>> end >>> >>> AirTelRecharge.new.execute >>> >>> >>> >>> On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: Those two locators should find the same element, but it appears it is not if one says the element exists but is not visible and the other says it is visible. To figure out why it is finding a different element, I'd need to see the underlying html. On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: > > 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 > > 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:
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Here is the Html code Pay Bill Savings Account http://schema.org/WebSite"; itemscope=""> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-35987772-1']); _gaq.push(['_setDomainName', 'airtel.in']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setAllowAnchor', true]); _gaq.push(['_addIgnoredRef', 'airtel.in']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; //ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; ga.src = ('app/libs/edited/homepage/dc.js?version=1490500432236'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); On Monday, March 27, 2017 at 2:13:16 PM UTC-7, Titus Fortner wrote: > > I'd need to see the html to see why it works for one of the locator > strategies, but not the other. > > On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan > wrote: > >> Here is the code >> >> >> >> require 'watir' >> class AirTelRecharge >> def initialize >> caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: >> false) >> @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: >> "default" >> @b.goto "https://www.airtel.in/"; >> @driver=@b.driver >> @driver.manage.timeouts.implicit_wait=10 >> end >> >> def execute >> @b.element(:text, 'Pay & Recharge').click >> @driver.find_element(:link,'Recharge').click #Here is the problem this >> code doesn't work for @b.element(:text,'Recharge').click >> end >> end >> >> AirTelRecharge.new.execute >> >> >> >> On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >>> >>> Those two locators should find the same element, but it appears it is >>> not if one says the element exists but is not visible and the other says it >>> is visible. To figure out why it is finding a different element, I'd need >>> to see the underlying html. >>> >>> >>> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: 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 > 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. >> >> watir-...@googlegroups.com >> http://groups.google.com/group/watir-general >> watir-genera...@googlegroups.com >> >> --- >> 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 watir-genera...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > --
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
I'd need to see the html to see why it works for one of the locator strategies, but not the other. On Mon, Mar 27, 2017 at 1:21 PM, Raja gopalan wrote: > Here is the code > > > > require 'watir' > class AirTelRecharge > def initialize > caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: > false) > @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: > "default" > @b.goto "https://www.airtel.in/"; > @driver=@b.driver > @driver.manage.timeouts.implicit_wait=10 > end > > def execute > @b.element(:text, 'Pay & Recharge').click > @driver.find_element(:link,'Recharge').click #Here is the problem this > code doesn't work for @b.element(:text,'Recharge').click > end > end > > AirTelRecharge.new.execute > > > > On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: >> >> Those two locators should find the same element, but it appears it is not >> if one says the element exists but is not visible and the other says it is >> visible. To figure out why it is finding a different element, I'd need to >> see the underlying html. >> >> >> On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: >>> >>> 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 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. > > watir-...@googlegroups.com > http://groups.google.com/group/watir-general > watir-genera...@googlegroups.com > > --- > 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 watir-genera...@googlegroups.com. > 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. > > watir-general@googlegroups.com > http://groups.google.com/group/watir-general > watir-general+unsubscr...@googlegroups.com > > --- > 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 watir-general+unsubscr...@googlegroups.com. > 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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Here is the code require 'watir' class AirTelRecharge def initialize caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: false) @b=Watir::Browser.new :firefox, desired_capabilities: caps, profile: "default" @b.goto "https://www.airtel.in/"; @driver=@b.driver @driver.manage.timeouts.implicit_wait=10 end def execute @b.element(:text, 'Pay & Recharge').click @driver.find_element(:link,'Recharge').click #Here is the problem this code doesn't work for @b.element(:text,'Recharge').click end end AirTelRecharge.new.execute On Monday, March 27, 2017 at 8:48:37 AM UTC-7, Titus Fortner wrote: > > Those two locators should find the same element, but it appears it is not > if one says the element exists but is not visible and the other says it is > visible. To figure out why it is finding a different element, I'd need to > see the underlying html. > > > On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: >> >> 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 >>> 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. watir-...@googlegroups.com http://groups.google.com/group/watir-general watir-genera...@googlegroups.com --- 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 watir-genera...@googlegroups.com. 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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
Those two locators should find the same element, but it appears it is not if one says the element exists but is not visible and the other says it is visible. To figure out why it is finding a different element, I'd need to see the underlying html. On Sunday, March 26, 2017 at 11:38:52 PM UTC-5, Raja gopalan wrote: > > 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 >> 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. >>> >>> watir-...@googlegroups.com >>> http://groups.google.com/group/watir-general >>> watir-genera...@googlegroups.com >>> >>> --- >>> 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 watir-genera...@googlegroups.com. >>> 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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
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 > 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. >> >> watir-...@googlegroups.com >> http://groups.google.com/group/watir-general >> watir-genera...@googlegroups.com >> >> --- >> 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 watir-genera...@googlegroups.com . >> 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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
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 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. > > watir-general@googlegroups.com > http://groups.google.com/group/watir-general > watir-general+unsubscr...@googlegroups.com > > --- > 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 watir-general+unsubscr...@googlegroups.com. > 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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Selenium clicks the line but WATIR doesn't click the same link, So there is a bug the way WATIR identifying the Link
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. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com --- 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 watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.