How to use Watir with Javascript triggered elements -
can tell me how click watir on element triggered javascript events.
for instance, on http://www.kissmetrics.com/, on homepage, if click on 'learn more' button on example image, bring lightbox. can click n 'get started' button move on the registration page.
how can simulate thing in watir? ie. how can click on first on 'learn more', on 'get started' button?
thanks help.
well there javascript events fired when click, may not ones particular element looking for. , element has first put state can click on via mouseover.
so trick figure out events need fired (see zeljko's answer) , use .fireevent method fire events against elements need see them, in order required.
a lot of times pretty have reverse engineer developers doing looking see elements in html looking events.
in specific case, if intent click blue learn more button seems on top of kind of screen shot, examining html or dom shows has convenient id value used. can see 'wired' respond onclick event, , more importantly opening new modal window (in case div looks popup) onclick="new modal('learn_more_content', {top: 110, modalclass: 'borderless'}).show()
. following code ought work launch modal
browser.button(:id, "learn_more_btn").click
then click green 'get started' button (of there several need way indicate one)
browser.p(:class, "cta").button(:class, "green button has_arrow").click
Comments
Post a Comment