Reputation: 21
When attempting to input a string 'customer asked for 30% discount'
to a form by using type_keys()
in Pywinauto 0.6.5, the output it sends is 'customer asked for 30 discount"
omitting '%'
.
Tried escape character:
control.type_keys('customer asked for 30%% discount',with_spaces=True)
control.type_keys('customer asked for 30\% discount',with_spaces=True)
But it still omits the '%'
When printing data in console string outputs correctly. So it is not a Python 3.7 issue.
Upvotes: 2
Views: 2230
Reputation: 1060
here's a little utility I use to prep passwords when using pywinauto.handler.type_keys():
password = 'cJ/Dy}(4H%x!c{)6'
clean_pass = ''
for c in password:
if c in ['(', ')', '{', '}', '%']:
clean_pass += ('{' + c + '}')
else:
clean_pass += c
print(clean_pass)
Upvotes: 1
Reputation: 9991
As Redem already found, some special symbols must be escaped this way:
control.type_keys('customer asked for 30{%} discount', with_spaces=True)
or method .set_edit_text()
can be used for edit box control:
control.set_edit_text(r'customer asked for 30% discount')
Upvotes: 5