Checking a checkbox failed because: 'bool' object has no attribute 'is_selected'

54 views
Skip to first unread message

Lew Funk

unread,
May 26, 2014, 4:30:11 PM5/26/14
to lettuc...@googlegroups.com
New Lettuce/Python user, it's pretty cool.

I'm messing around, trying to write a test that checks a checkbox on a page, but though the object is recognized the test fails with the following output: 

    And I check "apartment"                                                          # usr/local/lib/python2.7/dist-packages/lettuce_webdriver/webdriver.py:311
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/lettuce/core.py", line 144, in __call__
        ret = self.function(self.step, *args, **kw)
      File "/usr/local/lib/python2.7/dist-packages/lettuce_webdriver/webdriver.py", line 315, in check_checkbox
        check_box.click()
      File "/usr/local/lib/python2.7/dist-packages/lettuce_webdriver/webdriver.py", line 314, in check_checkbox
        if not check_box.is_selected():
    AssertionError: And I check "apartment", failed because: 'bool' object has no attribute 'is_selected'

I'd appreciate any direct answers, hints or direction to helpful material. 

Thanks
LF

MA1

unread,
May 27, 2014, 1:27:06 AM5/27/14
to lettuc...@googlegroups.com
I think it should be slected 
Which version of lettuce you are using?
Please share your code.

Corey Griggs

unread,
May 27, 2014, 3:54:14 PM5/27/14
to lettuc...@googlegroups.com
Lew - It looks like you're trying to check if a non-DOM object is visible. Try checking the definition of your variable 'check_box' - it looks 'check_box' is true or false instead of an element in the DOM.

Corey Griggs

unread,
May 27, 2014, 3:55:41 PM5/27/14
to lettuc...@googlegroups.com
*correction - checking to see if it is selected, not visible.
Reply all
Reply to author
Forward
0 new messages