I just right clicked on the buttons and did inspect element then took their text
On Wed, Dec 4, 2013 at 10:09 AM, Liz Goodson <[email protected]> wrote: > Oscar, > > Thanks so much for your response. > > Are you suggesting that I can treat a javascript button just like an html > button? That is not working for me, but it is probably because I am not > accessing the button with the write tag information. > > When you wrote your code to access the buttons on the Apprise page and > their popups, how did you know what values to specify for text/id? I > searched the Apprise page source code and didn't see > "apprise-btn-confirm". From what I read on the Apprise page, the default > for the id would be 'confirm' and I don't see that being overwritten in the > code. > > I'm not actually sure what version of apprise is being used in the code I > am testing. Here is what I can find about the external javascript source: > > > <script src="/static/ncl/js/jquery.1.6.min.js"></script> > <script src="/static/ncl/js/plugins.js"></script> > <script src="/static/ncl/js/plugin-functions.js"></script> > <script src="/static/ncl/js/jquery.autotab.js"></script> > <script src="/static/ncl/js/ncl.js?r=2"></script> > > I see no mention of apprise at all. Could it be imbedded in one of these > js files? > > I am going to talk with the developer about the apprise code today, in > case he understands something I don't (which is quite likely) > > Thanks, > Liz. > > On Monday, December 2, 2013 11:23:01 AM UTC-6, Oscar.Rieken wrote: > >> I tried this out on the Apprise page and it worked fine. >> >> > b = Watir::Browser.new :chrome >> => #<Watir::Browser:0x..fb82cba33eb6a57be url="about:blank" >> title="about:blank"> >> > b.goto "http://labs.bigroomstudios.com/libraries/Apprise-v2" >> => "http://labs.bigroomstudios.com/libraries/Apprise-v2" >> > content = b.button(text: "Apprise('hi there');").click >> => [] >> > b.button(id: "apprise-btn-confirm").click >> => [] >> > content = b.button(text: "Apprise('hi there');").click >> => [] >> > b.button(id: "apprise-btn-confirm").click >> => [] >> > content = b.button(text: "Apprise('Lorem ipsum...');").click >> => [] >> > b.button(id: "apprise-btn-confirm").click >> => [] >> >> worked fine in firefox as well >> >> > b = Watir::Browser.new :firefox >> => #<Watir::Browser:0x..fd31603afe9eface url="about:blank" title=""> >> > b.goto "http://labs.bigroomstudios.com/libraries/Apprise-v2" >> => "http://labs.bigroomstudios.com/libraries/Apprise-v2" >> > content = b.button(text: "Apprise('hi there');").click >> => [] >> > b.button(id: "apprise-btn-confirm").click >> => [] >> > content = b.button(text: "Apprise('Lorem ipsum...');").click >> => [] >> > b.button(id: "apprise-btn-confirm").click >> >> >> >> >> On Mon, Dec 2, 2013 at 11:22 AM, Liz Goodson <[email protected]> wrote: >> >>> The code that I am testing presents a confirmation dialog box, with two >>> options - "Yes" and "No". >>> >>> At first my code was bombing on the >>> >>> browser.alert.ok >>> >>> I was graciously advised by Jarmo to downgrade my ffi to 1.9.0. That >>> eliminated the problem, but now I have a new one: >>> >>> >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:226:in >>> `rescue in wait_until_present': Window with locator {:index=>0, >>> /^(?-mix:Message\ from\ webpage|Windows\ Internet\ Explorer|Microsoft\ >>> Internet\ Explorer|(?-mix:Mensaje de p.*)|Explorer\ User\ Prompt)$/i} >>> doesn't ex >>> not visible! (RAutomation::UnknownWindowException) >>> from >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:224:in >>> `wait_until_present' >>> from >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:206:in >>> `button' >>> from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-4.0.1/ >>> lib/watir-classic/dialogs/alert.rb:37:in `ok' >>> from Eval.rb:112:in `block (2 levels) in <main>' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1792:in `each' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1208:in `block in foreach' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1354:in `open' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1207:in `foreach' >>> from Eval.rb:44:in `block in <main>' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1792:in `each' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1208:in `block in foreach' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1354:in `open' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1207:in `foreach' >>> from Eval.rb:32:in `<main>' >>> >>> >>> I have also tried >>> >>> browser.alert.set "Yes" >>> >>> >>> which produces a similar effect: >>> >>> >>> >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:226:in >>> `rescue in wait_until_present': Window with locator {:index=>0, >>> /^(?-mix:Message\ from\ webpage|Windows\ Internet\ Explorer|Microsoft\ >>> Internet\ Explorer|(?-mix:Mensaje de p.*)|Explorer\ User\ Prompt)$/i} >>> doesn't exi >>> not visible! (RAutomation::UnknownWindowException) >>> from >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:224:in >>> `wait_until_present' >>> from >>> C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.13.0/lib/rautomation/window.rb:214:in >>> `text_field' >>> from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-4.0.1/ >>> lib/watir-classic/dialogs/alert.rb:44:in `set' >>> from Eval.rb:113:in `block (2 levels) in <main>' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1792:in `each' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1208:in `block in foreach' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1354:in `open' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1207:in `foreach' >>> from Eval.rb:44:in `block in <main>' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1792:in `each' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1208:in `block in foreach' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1354:in `open' >>> from C:/Ruby193/lib/ruby/1.9.1/csv.rb:1207:in `foreach' >>> from Eval.rb:32:in `<main>' >>> >>> In addition, I have tried >>> >>> browser.execute_script("window.confirm = function() {return true}") >>> >>> >>> It doesn't bomb. It exits without error, but the dialog is still >>> present and the code under test continues to wait for a button to be >>> pressed. >>> >>> I have looked at the source code for the submit button and the ensuing >>> popup, and it is using "apprise" >>> >>> >>> <div class="grid_16 submitButtons"> >>> <input style="display: inline; float left;" >>> id="offer_form_submit"type="submit" value="Continue" onclick="return >>> showPopConfirm()" /> >>> </div> >>> ... >>> function showPopConfirm() >>> { >>> apprise('Did the Disclosure documents print correctly?', >>> {'verify':true, 'textYes':'Yes', 'textNo':'No'}, >>> function(e){ >>> if(!e){ >>> apprise(' Note: Click the "Click to Print Offer" button to reprint >>> disclosure details.', >>> {},function(){}); >>> return; >>> } >>> // form is being submitted here. Something is stopping >>> it from being validated. >>> $('#decideOfferForm').submit(); >>> >>> } >>> ); >>> } >>> >>> Anyone have any experience with javascript dialogs that use "apprise"? >>> What ruby/Watir code should I use to click the "Yes" button? >>> >>> Thanks for your invaluable help. >>> Liz >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> -- >>> -- >>> Before posting, please read http://watir.com/support. In short: search >>> before you ask, be nice. >>> >>> [email protected] >>> http://groups.google.com/group/watir-general >>> [email protected] >>> >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Watir General" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >> >> -- > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
