selector_builder.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:nerodia 作者: watir 项目源码 文件源码
def _given_xpath_or_css(self, selector):
        xpath = selector.pop('xpath', None)
        css = selector.pop('css', None)

        if not (xpath or css):
            return None

        if xpath and css:
            raise ValueError("'xpath' and 'css' cannot be combined ({})".format(selector))

        how, what = [None] * 2
        if xpath:
            how = By.XPATH
            what = xpath
        elif css:
            how = By.CSS_SELECTOR
            what = css

        if selector and not self._can_be_combined_with_xpath_or_css(selector):
            raise ValueError('{} cannot be combined with other selectors {})'.format(how, selector))

        return [how, what]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号