shaik
shaik

Reputation: 153

How to access the <body> tags using watir

I am trying to compose an email through watir. So when I trying to access it, it has the <body> tag. Can anyone suggest how to access it?

My system configurations

IE-8Inter code here
Windows-7

I did the following

require 'rubygems'
require 'watir'
@ie.text_field(:id,':13r').set 'sample'



HTML CODE






<iframe tabIndex="1" class="Am Al editable" id=":13s" src="" frameBorder="0"
              style="padding-bottom: 0px; background-color: white; padding-left: 
           0px; padding-right: 0px; height: 248px; overflow: visible; padding-top:  
      0px;" allowTransparency="" closure_lm_162187="null" target="[object]" 
    originalTarget="undefined">
    <html>
    <head>
    <title></title>
    <style>CSSSTYLEsheet</style>
    </head> 
             <body class="editable LW-avf" id=":158" role="textbox" 
            contentEditable="true" hideFocus="hidefocus" closure_lm_478727="[object Object]" g_editable="true"/>
</html>

I am trying to access it as textbox as the "role" attribute has the value as "textbox".

I got the error :274:in assert_not_readonly' from C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/input_elem ents.rb:368:inset'

I am Trying to compose the mail through Watir,the element that I tried access is body can anyone tell me how to access it

Upvotes: 2

Views: 1060

Answers (2)

orde
orde

Reputation: 5283

There's a body method in watir-classic, and there's a body method in watir-webdriver.

Per the watir-classic documentation, you can locate the element a number of ways, including the id attribute or an arbitrary HTML attribute:

browser.body(:id => "htmlid")
browser.body(:foo => "value-of-foo-attribute)

Upvotes: 1

khan
khan

Reputation: 547

The above it has iframe element try as

@ie.iframe(:id,':13r').body(:id,':13r').set 'sample'

Upvotes: 2

Related Questions