def _build_wd_selector(self, selectors):
if any(isinstance(val, re._pattern_type) for val in selectors.values()):
return None
if not selectors.pop('tag_name', None):
raise Error('internal error: no tag_name?!')
button_attr_exp = self.xpath_builder.attribute_expression('button', selectors)
xpath = './/button'
if button_attr_exp:
xpath += '[{}]'.format(button_attr_exp)
if selectors.get('type') is not False:
if selectors.get('type') in [None, True]:
selectors['type'] = Button.VALID_TYPES
input_attr_exp = self.xpath_builder.attribute_expression('input', selectors)
xpath += ' | .//input'
xpath += '[{}]'.format(input_attr_exp)
logging.debug({'build_wd_selector': xpath})
return ['xpath', xpath]
评论列表
文章目录