Hello,
I'm trying to test select form with selenium but getting empty selection
form.

I have set up fixtures in test case and I see that test db is populated
but  generated form is empty. What might be a problem? What am i doing
wrong that form can't get data drom test db?
thanks
Woj

django=1.11
selenium=3.4.1

forms.py
class SetupForm(forms.Form):
    CHOICES = [(item[0], item[1].name) for item in
enumerate(Library.objects.all())]
    library = forms.ChoiceField(widget=forms.Select, choices=CHOICES)



views.py
def index(request):
    epoch_time = int(time.time())
    setup_form = SetupForm()
    return render(request, 'index.html', {'setup_form': setup_form,
'epoch_time': epoch_time})



models.py
class Library(models.Model):
    name = models.CharField(max_length=100)
    library_code = models.CharField(max_length=20)



functional_tests.py
class NewVisitorTest(StaticLiveServerTestCase):
    fixtures = ['library.json', 'circdesk.json']

    def setUp(self):
        self.browser = webdriver.Firefox()

    def tearDown(self):
        self.browser.quit()

    def test_setting_up(self):
        self.browser.get(self.live_server_url)
        lib_select_box = self.browser.find_element_by_id('id_library')
        select = Select(lib_select_box)
        select.select_by_visible_text('Test Library')


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/39508f83-c596-48de-8a8a-70c694ab8198%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to