【发布时间】:2017-08-23 08:02:59
【问题描述】:
我有一个由框架组成的页面。我想访问框架的元素并操纵它们。我想使用模块来实现我的更改。这就是我的代码的样子。
<html>
<body>
<frame name="header" ></frame>
<frame name="center" >
<input name='quantity' type='text'>
<input name='ok' type='radio' value='ok'>
</frame>
<frame name="footer" ></frame>
然后我就有了像这样的 groovy 页面类
class myMainPage extends Page {
static content = {
myModule{module FrameModule}
}
}
class FrameModule extends Module {
def FrameElement
static content = {
Myframe { $('frame', name:'center') }
FrameElement {Myframe.find('input[name="quantity"]')}
myQuantity = FrameElement.module(TextInput)
myQuantity.text = '10'
}
}
我是这样测试的
Then:
to myMainPage
and:
myModule.myQuantity
通过设置我得到的模块
类没有这样的属性TextInput:FrameModule
我如何操作那些框架的元素
【问题讨论】:
-
请查看gebish.org/manual/current/#dealing-with-frames 您的 FrameModule 代码看起来很奇怪,能否确定这是您使用的确切代码。
标签: groovy automated-tests spock geb