Reputation: 23
I am doing automated tests with python and selenim web driver and need to login to website using complex password.
I need to pass any special charecters including caret sign (^) to the send_keys method but it doesn't work.
For example I try to supply the following password to the method: 45pEq8wfIj^K
The send_keys method will send following: 45pEq8wfIjK
(the caret sign is ommited)
I have tried to put the caret sign into curly braces and supply it to the method like {^}
but the result were empty curly braces {}
. Also tried escape sign and raw string = not a solution.
I have tried the solution provided by ou_ryperd and this seems to work, but I still experience the following problem:
I wrote the following code which works:
if "^" in password:
splitString = re.split(r"^", password)
user_field.send_keys(splitString[0])
user_field.send_keys(Keys.SHIFT + '6')
user_field.send_keys(splitString[1])
This works fine (only with one caret sign obviously) as I get the caret sign passed to the send_keys method correctly now.
But for some reason, there is one additional caret sign ^ before the first part of the string?! Any idea why this happens?
i.e. for the following password 45pEq8wfIj\^K
I get ^45pEq8wfIj\^K
Upvotes: 0
Views: 266