Raja gopalan
2017-08-02 06:14:39 UTC
Titus,
I tried but it both reports the following error.
If I use ,
b.alert.ok
then I am having the following error
Uncaught exception: undefined method `alert' for
#<Watir::HTMLElement:0x2050068>
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:140:in
`<top (required)>'
If I use
iframe.b.alert.ok
then I have the following error,
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:140:in `<top (required)>'
--
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-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I tried but it both reports the following error.
If I use ,
b.alert.ok
then I am having the following error
Uncaught exception: undefined method `alert' for
#<Watir::HTMLElement:0x2050068>
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:140:in
`<top (required)>'
If I use
iframe.b.alert.ok
then I have the following error,
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:140:in `<top (required)>'
Yes, you need to use `browser.alert.ok` directly
If you really need to do it in the context of iframe, you can do
`iframe.browser.alert.ok` (so long as iframe has already been located)
Selenium won't let you send any wire call that isn't related to an alert
if an alert is displayed.
--If you really need to do it in the context of iframe, you can do
`iframe.browser.alert.ok` (so long as iframe has already been located)
Selenium won't let you send any wire call that isn't related to an alert
if an alert is displayed.
Okay, this actually resolves the problem, Yes as you say, it's inside the
frame and when I use as shown below
iframe1 = browser.iframe(id: 'iframe1')
iframe1.element(id: 'element_inside_frame').click
it works, But another problem arises in the case of alert, I don't know
how to handle alert now.
If I write
iframe1.alert.ok
It simply throws the error by saying 'alert' function is not found for
iframe1. Can you tell me how to handle the alert when alert appears inside
the frame?
frame and when I use as shown below
iframe1 = browser.iframe(id: 'iframe1')
iframe1.element(id: 'element_inside_frame').click
it works, But another problem arises in the case of alert, I don't know
how to handle alert now.
If I write
iframe1.alert.ok
It simply throws the error by saying 'alert' function is not found for
iframe1. Can you tell me how to handle the alert when alert appears inside
the frame?
Working with iframes is approached differently in selenium & Watir.
In Selenium you are responsible for explicitly switching into and out of
driver.switch_to.frame('iframe1')
driver.find_element(id: 'element_inside_frame').click
driver.switch_to.default_content
driver.find_element(id: 'element_outside_frame').click
browser.iframe(id: 'iframe1').element(id: 'element_inside_frame').click
browser.element(id: 'element_outside_frame').click
The tradeoff for this behavior is that you have to include the iframe
definition as part of every element signature inside the iframe.
iframe1 = browser.iframe(id: 'iframe1')
iframe1.element(id: 'element_inside_frame').click
iframe1.element(id: 'also_inside_frame').click
You could have elements with the same id in multiple different
frames/browsing contexts. Watir requires you to explicitly specify which
one you want.
In Selenium you are responsible for explicitly switching into and out of
driver.switch_to.frame('iframe1')
driver.find_element(id: 'element_inside_frame').click
driver.switch_to.default_content
driver.find_element(id: 'element_outside_frame').click
browser.iframe(id: 'iframe1').element(id: 'element_inside_frame').click
browser.element(id: 'element_outside_frame').click
The tradeoff for this behavior is that you have to include the iframe
definition as part of every element signature inside the iframe.
iframe1 = browser.iframe(id: 'iframe1')
iframe1.element(id: 'element_inside_frame').click
iframe1.element(id: 'also_inside_frame').click
You could have elements with the same id in multiple different
frames/browsing contexts. Watir requires you to explicitly specify which
one you want.
But why this difficulty while I use in WATIR? Selenium is allowing me
to access without any these kind of trouble. WATIR should eases that the
selenium coding, but here it makes it difficult.
--
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
For more options, visit https://groups.google.com/d/optout.
to access without any these kind of trouble. WATIR should eases that the
selenium coding, but here it makes it difficult.
Watir should now only send the null value to the frame endpoint if the
element in question is inside an iframe. So this could make sense. You need
to include the iframe definition as a parent object whenever defining
elements inside of it.
--element in question is inside an iframe. So this could make sense. You need
to include the iframe definition as a parent object whenever defining
elements inside of it.
--
Before posting, please read http://watir.com/support. In short: search
before you ask, be nice.
http://groups.google.com/group/watir-general
---
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
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-***@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.