Ah, okay, sorry! I mistook that the declared variable has to be used. My problem was resolved, infact it's not even a alert, it's a html page comes within frame. Thanks for help.
On Thursday, August 3, 2017 at 1:16:48 PM UTC+5:30, Titus Fortner wrote: > > Ah, `iframe.b` is not `iframe.browser`. > > On Thursday, August 3, 2017 at 2:28:55 AM UTC-5, Raja gopalan wrote: >> >> No, clearly not! >> >> >> I have written the below code >> >> puts '-------------------------------------------------' >> iframe=b.iframe(id: "mymodalerr") >> puts b.class >> b.alert.ok >> puts '-------------------------------------------------' >> >> Output >> ------------------------------------------------- >> Watir::Browser >> This code has slept for the duration of the default timeout waiting for >> an Alert to exist. If the test is still passing, consider using >> Alert#exists? >> instead of rescuing UnknownObjectException >> Uncaught exception: unable to locate alert >> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.5.0/lib/watir/alert.rb:115:in >> `rescue >> in wait_for_exists' >> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.5.0/lib/watir/alert.rb:106:in >> `wait_for_exists' >> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.5.0/lib/watir/alert.rb:36:in >> `ok' >> C:/Users/rajagopalan.m/RubymineProjects/SeleniumLearning/Contact/ >> ModuleExample.rb:142:in `<top (required)>' >> >> Did you notice that b is Browser object? >> >> >> >> And when I write the below >> >> >> puts '-------------------------------------------------' >> iframe=b.iframe(id: "mymodalerr") >> puts iframe.b.class >> iframe.b.alert.ok >> puts '-------------------------------------------------' >> >> >> >> >> Output >> >> ------------------------------------------------- >> Watir::HTMLElement >> Uncaught exception: undefined method `alert' for >> #<Watir::HTMLElement:0x372de18> >> >> C:/Ruby23/lib/ruby/gems/2.3.0/gems/watir-6.5.0/lib/watir/elements/element.rb:693:in >> >> `method_missing' >> >> C:/Users/rajagopalan.m/RubymineProjects/SeleniumLearning/Contact/ModuleExample.rb:142:in >> >> `<top (required)>' >> >> >> >> >> So iframe.b is not returning Browser object, So this must be a bug? What >> do you say? >> >> On Wednesday, August 2, 2017 at 8:24:41 PM UTC+5:30, Titus Fortner wrote: >>> >>> The first error indicates that b is an element, not a browser. The >>> second error means there isn't an alert open. >> >> -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
