某个页面需要填写的字段比较多,需要定义一个类来封装入参,本页面有一个嵌入的iframe,方法如下:
1、定义页面元素(iframe页面)
//输入驾驶证姓名
driverNameInput { $('input', id: 'editor_name') }
//输入驾驶人身份证号
driverIDCardInput { $('input', id: 'editor_driverId') }
//点击保存按钮
driverSaveButton{$('a#btSaveDrivers').parent().$('span.l-btn-left') }
2、定义方法,填写参数或者某些点击的元素(iframe页面)
/**
* 客户信息页面操作TenantInformation为入参
*/
def addTenantInformation(TenantInformation tenantInformation) {
log.info("填写所有承租人信息")
//填写承租人姓名、身份证号码
czrnamelInput << tenantInformation.LesseeName
czrsfzInput << tenantInformation.IdentityNumber
houseNatureSelectButton.click()
houseNatureSelectClick.click()
//承租人手机号码
mobilePhoneInput << tenantInformation.MobilePhone
nationalitySelectButton.click()
nationalitySelectClick.