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

What is the proper way to submit a form? (DjangoClient) #471

Open
drernie opened this issue Feb 27, 2016 · 4 comments
Open

What is the proper way to submit a form? (DjangoClient) #471

drernie opened this issue Feb 27, 2016 · 4 comments

Comments

@drernie
Copy link

drernie commented Feb 27, 2016

Using the Django client, I can click on a link, but when I click on a button I get:

self = <splinter.driver.djangoclient.DjangoClientElement object at 0x112260890>

    def click(self):
        """
            Clicks in the element.
            """
>       raise NotImplementedError
E       NotImplementedError

with the element

elements <Element button at 0x11223d158>
outer_html <button class="w-button button" type="submit">
      Sign Up
  </button>

Am I missing something?

@drernie
Copy link
Author

drernie commented Feb 27, 2016

My initial hypothesis is that:

  • Button should be a DjangoClientControlElement
  • The 'submit' method should use 'getitem' instead of 'attire' for accessing form info.

@drernie
Copy link
Author

drernie commented Feb 27, 2016

Looking at: https://github.com/vijayanajay/projects/blob/master/opinionanalysis/Lib/site-packages/splinter/driver/djangoclient.py -- is that what is installed with pip install splinter[django]?

@drernie
Copy link
Author

drernie commented Feb 27, 2016

Okay, I managed to get it to work by calling 'submit' using the form's element:

    signup_form = browser.find_by_tag("form").first
    result = browser.submit(signup_form._element)

But, I don't see the 'submit' method in the documentation; that claims we can submit forms using the 'click link':

http://splinter.readthedocs.org/en/latest/elements-in-the-page.html?highlight=submit

You can click in buttons. Splinter follows any redirects, and submits forms associated with buttons.

Which is the proper idiom to use?

@drernie drernie changed the title DjangoClientElement does not implement 'click' for buttons? What is the proper way to submit a form? (DjangoClient) Feb 27, 2016
@drernie
Copy link
Author

drernie commented Feb 29, 2016

Ignore deleted comments. The submission is working properly, but there still seems to be a bug where buttons aren't clickable. May file a new bug about that some other time.

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

No branches or pull requests

1 participant