@then('I should be able to able to print with id "{el_id}"')
def step_impl(context, el_id):
if is_element_id_there(context, 'el_id'):
print(get_element_text_id(context, 'el_id'))
else:
raise Exception('Element with id: ' + el_id + ' not found')
我还通过定义变量
使用其他打印方式@then('I should be able to able to print with id "{el_id}"')
def step_impl(context, el_id):
if is_element_id_there(context, 'el_id'):
var = get_element_text_id(context, 'el_id')
print(var)
else:
raise Exception('Element with id: ' + el_id + ' not found')
注意:我已在我的bash个人资料中添加了--no-colors
和--no-capture
答案 0 :(得分:1)
在打印结束时添加换行符:
print(get_element_text_id(context, 'el_id') + '\n')
或
var = get_element_text_id(context, 'el_id')
print(var + '\n')