我的网页上有一个复选框,该复选框以 false 状态开始,我想使用 SST 将其切换为 true。但是,我一直收到AssertionError: Checkbox u'%' - was not toggled, value remains: False
. 我已经使用了两者set_checkbox_value()
并且都toggle_checkbox()
收到了相同的错误。我现在的代码行是toggle_checkbox(id_or_elem='cbLFav')
. 堆栈跟踪是:
DEBUG:SST:Checkbox: u'cbLFav' - was not toggled, value remains: False
DEBUG:SST:Stopping browser
FAIL (63.522 secs)
======================================================================
FAIL: ..04fitness-tracker
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Brenda\brenda_test\ENV\lib\site-packages\sst\cases.py", line 20
7, in run_test_script
exec self.code in self.context
File ".\04fitness-tracker.py", line 24, in <module>
toggle_checkbox(id_or_elem='cbLFav')
File "C:\Users\Brenda\brenda_test\ENV\lib\site-packages\sst\actions.py", line
467, in toggle_checkbox
_raise(msg)
File "C:\Users\Brenda\brenda_test\ENV\lib\site-packages\sst\actions.py", line
118, in _raise
raise AssertionError(msg)
AssertionError: Checkbox: u'cbLFav' - was not toggled, value remains: False
使用时set_checkbox_value
,我的代码看起来像set_checkbox_value('cbLFav', True)
。知道为什么这没有将值设置为 True 吗?
代码如下:<input type="checkbox" value="true" class="np_add_fav_cb" id="cbLFav" name="fav">