如何访问 <body>标签使用 watir [英] How to access the <body> tags using watir
问题描述
我正在尝试通过 watir 撰写电子邮件.因此,当我尝试访问它时,它具有 <body>标签.谁能建议如何访问它?
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?
我的系统配置
IE-8Inter code here
Windows-7
我做了以下
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".
我收到错误:274:in assert_not_readonly'来自 C:/svn/ruby/lib/ruby/gems/1.8/gems/watir-1.6.7/lib/watir/input_elements.rb:368:in
set'
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:in
set'
推荐答案
上面有 iframe 元素 try as
The above it has iframe element try as
@ie.iframe(:id,':13r').body(:id,':13r').set 'sample'
@ie.iframe(:id,':13r').body(:id,':13r').set 'sample'
这篇关于如何访问 <body>标签使用 watir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!