Selenium2Library系列 keywords 之 _SelectElementKeywords 之_get_select_list_options(self, select_list_or_...

本文介绍了一个用于自动化测试的方法,该方法能够从Select元素中获取所有选项。此方法首先判断输入参数类型,如果是Select对象则直接使用,否则通过定位器获取Select对象。
1     def _get_select_list_options(self, select_list_or_locator):
2         if isinstance(select_list_or_locator, Select):
3             select = select_list_or_locator
4         else:
5             select = self._get_select_list(select_list_or_locator)
6         return select, select.options

方法名:_get_select_list_options(self, select_list_or_locator)

私有方法 返回Select 元素对象和options集合

接收参数:Select 对象或locator

第2行:判断传入的参数是否为Select类型

第3行:如果true,则直接赋值给select变量

第5行:否则使用_get_select_list(self, locator)方法,返回Select对象

第6行:返回Select对象和它的options集合

 

转载于:https://www.cnblogs.com/loveok-56/p/4457536.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值