formfill.py 文件源码

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

项目:Tencent_Cartoon_Download 作者: Fretice 项目源码 文件源码
def _find_form(el, form_id=None, form_index=None):
    if form_id is None and form_index is None:
        forms = _forms_xpath(el)
        for form in forms:
            return form
        raise FormNotFound(
            "No forms in page")
    if form_id is not None:
        form = el.get_element_by_id(form_id)
        if form is not None:
            return form
        forms = _form_name_xpath(el, name=form_id)
        if forms:
            return forms[0]
        else:
            raise FormNotFound(
                "No form with the name or id of %r (forms: %s)"
                % (id, ', '.join(_find_form_ids(el))))               
    if form_index is not None:
        forms = _forms_xpath(el)
        try:
            return forms[form_index]
        except IndexError:
            raise FormNotFound(
                "There is no form with the index %r (%i forms found)"
                % (form_index, len(forms)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号