Re: [wtr-general] Re: problem when locating the element
After I have installed the gem, I started running with require 'ffmpeg-screenrecorder' And it throws the following error C:\Ruby25\bin\ruby.exe Example.rb INFO: Could not find files for the given pattern(s). Traceback (most recent call last): 2: from Example.rb:12:in `' 1: from C:/Ruby25/lib/ruby/gems/2.5.0/gems/ffmpeg-screenrecorder-1.0.0.beta9/lib/ffmpeg/screenrecorder.rb:24:in `start' C:/Ruby25/lib/ruby/gems/2.5.0/gems/ffmpeg-screenrecorder-1.0.0.beta9/lib/ffmpeg/screenrecorder.rb:60:in `start_ffmpeg': ffmpeg binary not found. (FFMPEG::RecorderErrors:: DependencyNotFound) On Saturday, 2 February 2019 03:02:21 UTC+5:30, Lakshya Kapoor wrote: > > Awesome! You can checkout some example code and a demo here - > https://kapoorlakshya.github.io/introducing-ffmpeg-screenrecorder > > On Friday, February 1, 2019 at 10:24:00 AM UTC-8, rajagopalan madasami > wrote: >> >> Hi, I have done my framework work, now I am going to include your >> recorder into my project. >> >> On Tue, 6 Nov, 2018, 11:41 PM Lakshya Kapoor > >>> Perfect time to share a gem I am working on :) >>> >>> https://github.com/kapoorlakshya/ffmpeg-screenrecorder >>> >>> This should help you create a video recording of your test execution. >>> You can then host it on streamable or YouTube. >>> >>> On Tuesday, November 6, 2018 at 10:05:04 AM UTC-8, rajagopalan madasami >>> wrote: Hi Justin, I can share my screen if you want. You can take control of my system. Do you have team viewer or do you have any business skype? I can share my screen via that. On Tue 6 Nov, 2018, 11:27 PM Justin Ko >>> > Any chance you can capture a video of the test? It's hard to reconcile > this discussion and logs without seeing anything. > > Justin > > On Tuesday, November 6, 2018 at 12:37:01 PM UTC-5, rajagopalan > madasami wrote: >> >> I am calling this function >> >> def waitForPageLoad >> >> @b.wait_until(timeout: @Page_Load) {@b.execute_script("return >> (jQuery.active === 0)").eql? true} >> end >> >> function in every click function like >> >> def clickButton(locator, action, name, data) >> puts "ClickButton : #{name}" >> loc = getLocator(locator) >> @b.button(loc.first => loc.last).click >> waitForPageLoad >> end >> >> Do you see the clickButton method >> >> calls waitForPageLoad at the end so it waits for the spinner disappear. >> So it doesn't click on the spinner. Even if it clicks at the >> >> spinner it retry it because I have included >> Selenium::WebDriver::Error::ElementClickInterceptedError >> >> rescue Selenium::WebDriver::Error::ElementNotVisibleError, >> Selenium::WebDriver::Error::ElementNotInteractableError,Selenium::WebDriver::Error::ElementClickInterceptedError >> raise_present unless Wait.timer.remaining_time.positive? >> raise_present unless %i[wait_for_present wait_for_enabled >> wait_for_writable].include?(precondition) >> retry >> >> So all I am seeing here is, It perfectlys lands on a page, and it >> successfully enters into the click method but it waits for 30 seconds >> and it fails. >> >> >> >> >> On Tue, 6 Nov 2018 at 22:51, Titus Fortner >> wrote: >> >>> Yes, this makes sense from the code perspective. >>> >>> What your site is doing is requiring you to accept an alert, then it >>> does some kind of processing, then it refreshes some/all of the page. >>> >>> Your code is trying to click the element before the refresh has >>> happened, and because of the way you are rescuing it, it is giving >>> you >>> misleading information. The element was located but couldn't be used, >>> then at the point it is trying to be used it is stale, and that >>> method >>> isn't relocating when stale. >>> >>> Can you raise an issue on Github with this gist? Something like >>> "Watir >>> should relocate stale elements when trying to click them" >>> >>> In the meantime, something like this should work: >>> >>> @b.alert.ok >>> @b.div(id: "spinnerOverlay").wait_while(&:present?) >>> @b.button(id: "NavContinue").click >>> >>> >>> On Tue, Nov 6, 2018 at 10:56 AM wrote: >>> > >>> > Hi Titus, >>> > >>> > Here is the gist url >>> > >>> > >>> https://gist.github.com/Rajagopalan-M/ba78aed6342c61d07968cfe195d3f4de >>> > >>> > -- >>> > -- >>> > Before posting, please read >>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group >>> . >>> > 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
Re: [wtr-general] Re: problem when locating the element
Oh I could install the gem using the following command gem install ffmpeg-screenrecorder --pre On Saturday, 2 February 2019 03:02:21 UTC+5:30, Lakshya Kapoor wrote: > > Awesome! You can checkout some example code and a demo here - > https://kapoorlakshya.github.io/introducing-ffmpeg-screenrecorder > > On Friday, February 1, 2019 at 10:24:00 AM UTC-8, rajagopalan madasami > wrote: >> >> Hi, I have done my framework work, now I am going to include your >> recorder into my project. >> >> On Tue, 6 Nov, 2018, 11:41 PM Lakshya Kapoor > >>> Perfect time to share a gem I am working on :) >>> >>> https://github.com/kapoorlakshya/ffmpeg-screenrecorder >>> >>> This should help you create a video recording of your test execution. >>> You can then host it on streamable or YouTube. >>> >>> On Tuesday, November 6, 2018 at 10:05:04 AM UTC-8, rajagopalan madasami >>> wrote: Hi Justin, I can share my screen if you want. You can take control of my system. Do you have team viewer or do you have any business skype? I can share my screen via that. On Tue 6 Nov, 2018, 11:27 PM Justin Ko >>> > Any chance you can capture a video of the test? It's hard to reconcile > this discussion and logs without seeing anything. > > Justin > > On Tuesday, November 6, 2018 at 12:37:01 PM UTC-5, rajagopalan > madasami wrote: >> >> I am calling this function >> >> def waitForPageLoad >> >> @b.wait_until(timeout: @Page_Load) {@b.execute_script("return >> (jQuery.active === 0)").eql? true} >> end >> >> function in every click function like >> >> def clickButton(locator, action, name, data) >> puts "ClickButton : #{name}" >> loc = getLocator(locator) >> @b.button(loc.first => loc.last).click >> waitForPageLoad >> end >> >> Do you see the clickButton method >> >> calls waitForPageLoad at the end so it waits for the spinner disappear. >> So it doesn't click on the spinner. Even if it clicks at the >> >> spinner it retry it because I have included >> Selenium::WebDriver::Error::ElementClickInterceptedError >> >> rescue Selenium::WebDriver::Error::ElementNotVisibleError, >> Selenium::WebDriver::Error::ElementNotInteractableError,Selenium::WebDriver::Error::ElementClickInterceptedError >> raise_present unless Wait.timer.remaining_time.positive? >> raise_present unless %i[wait_for_present wait_for_enabled >> wait_for_writable].include?(precondition) >> retry >> >> So all I am seeing here is, It perfectlys lands on a page, and it >> successfully enters into the click method but it waits for 30 seconds >> and it fails. >> >> >> >> >> On Tue, 6 Nov 2018 at 22:51, Titus Fortner >> wrote: >> >>> Yes, this makes sense from the code perspective. >>> >>> What your site is doing is requiring you to accept an alert, then it >>> does some kind of processing, then it refreshes some/all of the page. >>> >>> Your code is trying to click the element before the refresh has >>> happened, and because of the way you are rescuing it, it is giving >>> you >>> misleading information. The element was located but couldn't be used, >>> then at the point it is trying to be used it is stale, and that >>> method >>> isn't relocating when stale. >>> >>> Can you raise an issue on Github with this gist? Something like >>> "Watir >>> should relocate stale elements when trying to click them" >>> >>> In the meantime, something like this should work: >>> >>> @b.alert.ok >>> @b.div(id: "spinnerOverlay").wait_while(&:present?) >>> @b.button(id: "NavContinue").click >>> >>> >>> On Tue, Nov 6, 2018 at 10:56 AM wrote: >>> > >>> > Hi Titus, >>> > >>> > Here is the gist url >>> > >>> > >>> https://gist.github.com/Rajagopalan-M/ba78aed6342c61d07968cfe195d3f4de >>> > >>> > -- >>> > -- >>> > Before posting, please read >>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group >>> . >>> > 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 >>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. >>> >>> >>> In short: search before you
Re: [wtr-general] Re: problem when locating the element
Hi when I try to install the gem gem install ffmpeg-screenrecorder C:\Users\rajagopalan.m>gem install ffmpeg-screenrecorder ERROR: Could not find a valid gem 'ffmpeg-screenrecorder' (>= 0) in any repository ERROR: Possible alternatives: screen_recorder, message-recorder So should I have to install screen_recorder? Or message-recorder? On Saturday, 2 February 2019 03:02:21 UTC+5:30, Lakshya Kapoor wrote: > > Awesome! You can checkout some example code and a demo here - > https://kapoorlakshya.github.io/introducing-ffmpeg-screenrecorder > > On Friday, February 1, 2019 at 10:24:00 AM UTC-8, rajagopalan madasami > wrote: >> >> Hi, I have done my framework work, now I am going to include your >> recorder into my project. >> >> On Tue, 6 Nov, 2018, 11:41 PM Lakshya Kapoor > >>> Perfect time to share a gem I am working on :) >>> >>> https://github.com/kapoorlakshya/ffmpeg-screenrecorder >>> >>> This should help you create a video recording of your test execution. >>> You can then host it on streamable or YouTube. >>> >>> On Tuesday, November 6, 2018 at 10:05:04 AM UTC-8, rajagopalan madasami >>> wrote: Hi Justin, I can share my screen if you want. You can take control of my system. Do you have team viewer or do you have any business skype? I can share my screen via that. On Tue 6 Nov, 2018, 11:27 PM Justin Ko >>> > Any chance you can capture a video of the test? It's hard to reconcile > this discussion and logs without seeing anything. > > Justin > > On Tuesday, November 6, 2018 at 12:37:01 PM UTC-5, rajagopalan > madasami wrote: >> >> I am calling this function >> >> def waitForPageLoad >> >> @b.wait_until(timeout: @Page_Load) {@b.execute_script("return >> (jQuery.active === 0)").eql? true} >> end >> >> function in every click function like >> >> def clickButton(locator, action, name, data) >> puts "ClickButton : #{name}" >> loc = getLocator(locator) >> @b.button(loc.first => loc.last).click >> waitForPageLoad >> end >> >> Do you see the clickButton method >> >> calls waitForPageLoad at the end so it waits for the spinner disappear. >> So it doesn't click on the spinner. Even if it clicks at the >> >> spinner it retry it because I have included >> Selenium::WebDriver::Error::ElementClickInterceptedError >> >> rescue Selenium::WebDriver::Error::ElementNotVisibleError, >> Selenium::WebDriver::Error::ElementNotInteractableError,Selenium::WebDriver::Error::ElementClickInterceptedError >> raise_present unless Wait.timer.remaining_time.positive? >> raise_present unless %i[wait_for_present wait_for_enabled >> wait_for_writable].include?(precondition) >> retry >> >> So all I am seeing here is, It perfectlys lands on a page, and it >> successfully enters into the click method but it waits for 30 seconds >> and it fails. >> >> >> >> >> On Tue, 6 Nov 2018 at 22:51, Titus Fortner >> wrote: >> >>> Yes, this makes sense from the code perspective. >>> >>> What your site is doing is requiring you to accept an alert, then it >>> does some kind of processing, then it refreshes some/all of the page. >>> >>> Your code is trying to click the element before the refresh has >>> happened, and because of the way you are rescuing it, it is giving >>> you >>> misleading information. The element was located but couldn't be used, >>> then at the point it is trying to be used it is stale, and that >>> method >>> isn't relocating when stale. >>> >>> Can you raise an issue on Github with this gist? Something like >>> "Watir >>> should relocate stale elements when trying to click them" >>> >>> In the meantime, something like this should work: >>> >>> @b.alert.ok >>> @b.div(id: "spinnerOverlay").wait_while(&:present?) >>> @b.button(id: "NavContinue").click >>> >>> >>> On Tue, Nov 6, 2018 at 10:56 AM wrote: >>> > >>> > Hi Titus, >>> > >>> > Here is the gist url >>> > >>> > >>> https://gist.github.com/Rajagopalan-M/ba78aed6342c61d07968cfe195d3f4de >>> > >>> > -- >>> > -- >>> > Before posting, please read >>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group >>> . >>> > 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
Re: [wtr-general] Re: problem when locating the element
Hi when I try to install the gem `ffmpeg-screenrecorder` I got the following error. Anything should I need correct? Or gem name changed? C:\Users\rajagopalan.m>gem install ffmpeg-screenrecorder ERROR: Could not find a valid gem 'ffmpeg-screenrecorder' (>= 0) in any repository On Saturday, 2 February 2019 03:02:21 UTC+5:30, Lakshya Kapoor wrote: > > Awesome! You can checkout some example code and a demo here - > https://kapoorlakshya.github.io/introducing-ffmpeg-screenrecorder > > On Friday, February 1, 2019 at 10:24:00 AM UTC-8, rajagopalan madasami > wrote: >> >> Hi, I have done my framework work, now I am going to include your >> recorder into my project. >> >> On Tue, 6 Nov, 2018, 11:41 PM Lakshya Kapoor > >>> Perfect time to share a gem I am working on :) >>> >>> https://github.com/kapoorlakshya/ffmpeg-screenrecorder >>> >>> This should help you create a video recording of your test execution. >>> You can then host it on streamable or YouTube. >>> >>> On Tuesday, November 6, 2018 at 10:05:04 AM UTC-8, rajagopalan madasami >>> wrote: Hi Justin, I can share my screen if you want. You can take control of my system. Do you have team viewer or do you have any business skype? I can share my screen via that. On Tue 6 Nov, 2018, 11:27 PM Justin Ko >>> > Any chance you can capture a video of the test? It's hard to reconcile > this discussion and logs without seeing anything. > > Justin > > On Tuesday, November 6, 2018 at 12:37:01 PM UTC-5, rajagopalan > madasami wrote: >> >> I am calling this function >> >> def waitForPageLoad >> >> @b.wait_until(timeout: @Page_Load) {@b.execute_script("return >> (jQuery.active === 0)").eql? true} >> end >> >> function in every click function like >> >> def clickButton(locator, action, name, data) >> puts "ClickButton : #{name}" >> loc = getLocator(locator) >> @b.button(loc.first => loc.last).click >> waitForPageLoad >> end >> >> Do you see the clickButton method >> >> calls waitForPageLoad at the end so it waits for the spinner disappear. >> So it doesn't click on the spinner. Even if it clicks at the >> >> spinner it retry it because I have included >> Selenium::WebDriver::Error::ElementClickInterceptedError >> >> rescue Selenium::WebDriver::Error::ElementNotVisibleError, >> Selenium::WebDriver::Error::ElementNotInteractableError,Selenium::WebDriver::Error::ElementClickInterceptedError >> raise_present unless Wait.timer.remaining_time.positive? >> raise_present unless %i[wait_for_present wait_for_enabled >> wait_for_writable].include?(precondition) >> retry >> >> So all I am seeing here is, It perfectlys lands on a page, and it >> successfully enters into the click method but it waits for 30 seconds >> and it fails. >> >> >> >> >> On Tue, 6 Nov 2018 at 22:51, Titus Fortner >> wrote: >> >>> Yes, this makes sense from the code perspective. >>> >>> What your site is doing is requiring you to accept an alert, then it >>> does some kind of processing, then it refreshes some/all of the page. >>> >>> Your code is trying to click the element before the refresh has >>> happened, and because of the way you are rescuing it, it is giving >>> you >>> misleading information. The element was located but couldn't be used, >>> then at the point it is trying to be used it is stale, and that >>> method >>> isn't relocating when stale. >>> >>> Can you raise an issue on Github with this gist? Something like >>> "Watir >>> should relocate stale elements when trying to click them" >>> >>> In the meantime, something like this should work: >>> >>> @b.alert.ok >>> @b.div(id: "spinnerOverlay").wait_while(&:present?) >>> @b.button(id: "NavContinue").click >>> >>> >>> On Tue, Nov 6, 2018 at 10:56 AM wrote: >>> > >>> > Hi Titus, >>> > >>> > Here is the gist url >>> > >>> > >>> https://gist.github.com/Rajagopalan-M/ba78aed6342c61d07968cfe195d3f4de >>> > >>> > -- >>> > -- >>> > Before posting, please read >>> https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group >>> . >>> > 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] WATIR can be used for AngularJS?
Thank you, let me check that tomorrow. On Sun, 3 Feb, 2019, 12:21 AM 'John Fitisoff' via Watir General < watir-general@googlegroups.com wrote: > I wrote something with Angular in mind. Some sample tests for Google's > angular components are here: > > > https://github.com/jfitisoff/insite/blob/master/spec/material_angular_io_spec.rb > > And Google's showcase for those components are here (the tests utilize > this site): > > https://material.angular.io > > I didn't incorporate Titus's gem because the library isn't limited to > Angular -- it's more about supporting web components and recurring features > -- but maybe I should add a pointer to that gem for folks testing Angular > apps. > > > > > > > > > > > On Thursday, January 31, 2019, 10:08:10 AM PST, rajagopalan madasami < > rajagopalanmadas...@gmail.com> wrote: > > > Hi, thank you very much . > > On Tue, 29 Jan, 2019, 8:45 PM Joe Fleck > Hi, > > Yes, there is watir_angular. > > https://github.com/titusfortner/watir_angular > > Joe > > On Tue, Jan 29, 2019, 10:10 AM > Hi Titus, > > Is it possible to automate AngularJs application using WATIR? Any gem is > available? > > -- > -- > Before posting, please read > https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. > > 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 > https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. > > 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 > https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. > > 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 > https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. > > 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 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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] WATIR can be used for AngularJS?
I wrote something with Angular in mind. Some sample tests for Google's angular components are here: https://github.com/jfitisoff/insite/blob/master/spec/material_angular_io_spec.rb And Google's showcase for those components are here (the tests utilize this site): https://material.angular.io I didn't incorporate Titus's gem because the library isn't limited to Angular -- it's more about supporting web components and recurring features -- but maybe I should add a pointer to that gem for folks testing Angular apps. On Thursday, January 31, 2019, 10:08:10 AM PST, rajagopalan madasami wrote: Hi, thank you very much . On Tue, 29 Jan, 2019, 8:45 PM Joe Fleck https://github.com/titusfortner/watir_angular Joe On Tue, Jan 29, 2019, 10:10 AM https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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 https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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] Re: Is there an autogenerated method in page-object that tell if the element is present?
Hi, 1. The monkey patch is redefining the method. Last definition wins. It is how Ruby is designed, nothing specific to Page-Object. A simpler isolated example: def a 'hi' end def a 'bye' end puts a #=> "bye" Notice that you can define the method twice, but when called, the last definition wins. 2. This is a scenario where you will want to use the widget feature (https://github.com/cheezy/page-object/wiki/Custom-page-object-elements-by-using-widgets). The code would be: # A class to represent your control (ie div that acts like a button) class DivButton < PageObject::Elements::Div def self.accessor_methods(accessor, name) # Adds method to perform click accessor.send(:define_method, "#{name}") do self.send("#{name}_element").click end end end PageObject.register_widget :div_button, DivButton, :div class MyPage include PageObject # Use div_button instead of div to use your widget div_button(:expand_perks_section_icon, :css => '.icon-plus-wrapper') end page = MyPage.new(browser) page.expand_perks_section_icon #=> triggers click on div page.expand_perks_section_icon? #=> has standard method to check element existence (or presence with the monkey patch) Hope that helps, Justin On Friday, February 1, 2019 at 6:17:10 PM UTC-5, NaviHan wrote: > > Thanks Justin.. > I have two more question though. > > 1. How does the the method in monkey_path.b takes precedence over the > method in actual page-object gem? > 2. There are may intances in the application where a div element receives > the click rather than a button. > > eg > div(:expand_perks_section_icon, :css => '.icon-plus-wrapper') > > > > This element is a div and receives the click as shown below. > def expand_perks_section > expand_perks_section_icon_element.when_present.click > end > > > > Writing a separate method each time for such things is really a pain. > Is there a better solution for such cases > > On Friday, 1 February 2019 00:11:33 UTC+11, NaviHan wrote: >> >> I have an element defined as >> >> div(:reward_history, :class => 'reward-history-header') >> >> >> The page-object gem generated four methods for this element which are >> >> >> 'reward_history', 'reward_history_element', and 'reward_history?' >> >> >> >> The fourth method 'reward_history?' check if the element exists in the >> DOM? >> >> >> But what if the element exists in the DOM but is hidden, which is >> basically checking if the element is present? >> >> >> Is there an autogenerated method for this? >> >> I tried 'reward_history(:?)' but didn't work >> >> As of now I have to write a method separately which does this >> >> def is_reward_history_present? >> return reward_history_element.present? >> end >> >> >> >> -- -- Before posting, please read https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group. 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.