1
@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')

I also used other way of printing by defining variable

@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')

Note: I already added --no-colors and --no-capture in my bash profile

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
lav
  • 25
  • 4
  • Possible duplicate of [How can I see print() statements in behave (BDD)](https://stackoverflow.com/questions/25150404/how-can-i-see-print-statements-in-behave-bdd) – Cynic Sep 14 '17 at 23:03
  • Did you add a behave.ini file? https://stackoverflow.com/a/25291321/3838981 – Cynic Sep 14 '17 at 23:04

1 Answers1

2

Add a newlines at the end of a print:

print(get_element_text_id(context, 'el_id') + '\n')

or

var = get_element_text_id(context, 'el_id')
print(var + '\n')
Raja David
  • 304
  • 7
  • 16