In general, you can achieve a similar interaction with the "document"
object by using the `execute_script` method.
For example, the line:
control.document.invoke("currentStyle").backgroundColor
Could be re-written as (assuming that "control" is a Watir::Element):
browser.execute_script('return arguments[0].currentStyle.backgroundColor',
control)
However, `currentStyle` is only defined in IE11, not Edge. As a result, the
above will not work in Edge. Instead you will need to use the
`getComputedStyle` method:
browser.execute_script('return
window.getComputedStyle(arguments[0]).backgroundColor;', control)
For this specific example, you can simply this further by using Watir's
built-in `style` method instead:
control.style('background-color')
- Justin Ko
On Tuesday, July 4, 2017 at 11:41:33 AM UTC-4, AROCKIA JERALD wrote:
>
> Hi all,
>
> I am migrating from watir-classic to watir-webdriver to support ms edge
> browser testing. I am facing an issue with *document object *which was
> specific to IE. There is no direct way to refer document object using
> watir-webdriver. Below is the code am referring and its exception. Can this
> group help me on this to overcome this issue?
>
> *Code:*
>
> Watir::Wait.until(@entrySelectionTimeout) {
>
> ((control.document.invoke("currentStyle").backgroundColor).eql?
> @selectedColor) &&
> (is_status_bar_visible?.eql? false)
> }
>
> *Exception:*
>
> Exception: undefined method `document' for
> #<Watir::TableDataCell:0x46f00c8>
>
> *Environment Used:*
>
> Ruby Version - 2.2.6p396
>
> *Gems used*
> commonwatir (3.0.0)
> watir (6.2.1)
> watir-classic (4.3.0)
> watir-webdriver (0.9.9)
>
>
> is there any options to achieve my requirement as per the above code which
> uses *webdriver*? However, same things were working perfectly fine with
> watir-classic.
>
>
>
--
--
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.