Just a guess but the page HTML may have multiple buttons that match value:
"OK" (and you're getting the very first one, which isn't the one that you
actually want.) It's been a while but think you could add visible: true if
that's the case, then it should find the one that you're looking for.
On Friday, February 5, 2021, 08:35:17 PM PST, Suresh Murthy
<[email protected]> wrote:
as you can see from the code, the button exists with text "OK". But i cannot
click on it. how do fix this ?irb(main):189:0> ie.button(value:"OK").html=>
"<input type=\"button\" onclick=\"javascript:makeList('1591993');\"
value=\"OK\">"irb(main):190:0> ie.button(value:"OK").exists?=>
trueirb(main):191:0> ie.button(value:"OK").click
2021-02-05 18:07:41 WARN Selenium [DEPRECATION]
Selenium::WebDriver::Error::ElementNotVisibleError is deprecated. Use
Selenium::WebDriver::Error::ElementNotInteractableError (ensure the driver
supports W3C WebDriver specification) instead.Traceback (most recent call
last): 8: from C:/Ruby26-x64/bin/irb.cmd:31:in `<main>' 7: from
C:/Ruby26-x64/bin/irb.cmd:31:in `load' 6: from
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top
(required)>' 5: from (irb):191 4: from
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/watir-6.16.5/lib/watir/elements/element.rb:145:in
`click' 3: from
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/watir-6.16.5/lib/watir/elements/element.rb:790:in
`element_call' 2: from
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/watir-6.16.5/lib/watir/elements/element.rb:803:in
`rescue in element_call' 1: from
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/watir-6.16.5/lib/watir/elements/element.rb:752:in
`raise_present'Watir::Exception::UnknownObjectException (element located, but
timed out after 30 seconds, waiting for #<Watir::Button: located: true;
{:value=>"OK", :tag_name=>"button"}> to be present)
--
--
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.
[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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/watir-general/21a8b6e5-3dbe-48cb-9741-4155c096795dn%40googlegroups.com.
--
--
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.
[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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/watir-general/1383891300.395390.1612588015901%40mail.yahoo.com.