Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added xpath support in FormRequest.from_response #185

Merged
merged 1 commit into from Jan 8, 2013

Conversation

Projects
None yet
2 participants
Contributor

notsobad commented Nov 6, 2012

Some form may leak name attribute or hard to get the formnumber, so I want to be able to find form by using xpath.

You can use //form[@name="reg"] , or just give an element from the form, like //form/input[@name="username"],

            yield FormRequest.from_response(response,
                formxpath='//form[@action="/admin/reg.php"]',
                formdata={'userid':'abc',  'pwd': '123'},
                callback=self.parse_page,
                )

            # or
            yield FormRequest.from_response(response,
                formxpath='//form/input[@name="userid"]',
                formdata={'userid':'abc',  'pwd': '123'},
                callback=self.parse_page,
                )

dangra added a commit that referenced this pull request Jan 8, 2013

Merge pull request #185 from notsobad/master
Added xpath support in FormRequest.from_response

@dangra dangra merged commit 7527ef9 into scrapy:master Jan 8, 2013

Owner

dangra commented Jan 8, 2013

nice feature, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment