adjacent.py 文件源码

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

项目:nerodia 作者: watir 项目源码 文件源码
def _xpath_adjacent(self, **kwargs):
        from .elements.html_elements import HTMLElement, HTMLElementCollection
        import nerodia

        plural = kwargs.pop('plural', None)
        index = kwargs.pop('index', None)
        tag_name = kwargs.get('tag_name')

        if not (plural or any(isinstance(val, re._pattern_type) for val in kwargs.values())):
            kwargs['index'] = index or 0

        if not plural and tag_name:
            klass = nerodia.tag_to_class.get(tag_name)
        elif not plural:
            klass = HTMLElement
        elif tag_name:
            klass = nerodia.tag_to_class.get('{}_collection'.format(tag_name))
        else:
            klass = HTMLElementCollection

        return klass(self, kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号