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

瀏覽次數:54 次
跳到第一則未讀訊息

Lew Funk

未讀,
2014年5月26日 下午4:30:112014/5/26
收件者: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

未讀,
2014年5月27日 凌晨1:27:062014/5/27
收件者:lettuc...@googlegroups.com
I think it should be slected 
Which version of lettuce you are using?
Please share your code.

Corey Griggs

未讀,
2014年5月27日 下午3:54:142014/5/27
收件者: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

未讀,
2014年5月27日 下午3:55:412014/5/27
收件者:lettuc...@googlegroups.com
*correction - checking to see if it is selected, not visible.
回覆所有人
回覆作者
轉寄
0 則新訊息