Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Parsing of empty select boxes failed #40

Merged
merged 4 commits into from Apr 18, 2015

Conversation

pratyushmittal
Copy link
Contributor

Hi Joshua,

RoboBrowser failed to parse forms where there were empty select boxes. I have added the tests as well as the fix for the same.

The use cases of empty select boxes are pretty common on ASP website where forms require multiple submits. Before the initial submit the select boxes are kept empty. On initial submit, the select boxes get a few options based on other values.

Do let me know if anything is required to be modified in the pull request.
Pratyush

…sed InvalidNameError.

This commit ensures that the tests pass no matter the user has installed whichever parsing library with bs4.

**Explanation:**

When using lxml (recommended parser in BeautifulSoup4) the parsing is little different then the inbuilt parser:

    BeautifulSoup('<input name="hi">')
    # gives "<html><body><input name='hi' /></body></html>"
    # while the inbuilt parser gives "<input name='hi' />"
    # Thus the add_field function used to fail by giving InvalidNameError

The parsing of complicated forms is way much better using `lxml` and RoboBrowser compliments it well.
The only issue caused was due to the individual field parsings.
Forcing inbuilt parser for fields parsing fixes the issues with individual fields while ensuring the efficiency of lxml for parsing of forms.
@pratyushmittal
Copy link
Contributor Author

Hi @jmcarp, RoboBrowser tests fail if we have the lxml library installed, giving an InvalidNameError. I have added a fix for the lxml in the latest commit along with the explanation.

Do let me know if you need any more details related to the issue. Thanks.

@jmcarp jmcarp merged commit eee0cd8 into jmcarp:master Apr 18, 2015
@jmcarp
Copy link
Owner

jmcarp commented Apr 18, 2015

Thanks for the fixes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants