I would like to know if I could call a function or an action, when a variable is utilized.
I have the text variable:
text = "This is My text, and I would like HERE a Smiley, but i'm not satisfied, so I want here a smiley with sunglasses, and right after HERE I would like an emoji with a heart."
Now, due to the fact with selenium I have to use javascript inject in order to put an emoji, and due to the fact it could not be done when the variable is initialized because the input does still not exist, is there a way to call a function which +='s the already inputted text with the unicode text? There are too many strings to be able to write a function for each, and too many sentences with emoji to write them down one by one.
what I would like to accomplish is something like this:
text = "I would like a " + emoji('heart') + " And that was great, but here I would like a " + emoji('sunglasses') + " And a magnificient" + emoji(unicorn)
this is the function which writes letter per letter the string: (where text is keys)
for key in keys:
print(key)
and in which, reached the emoji() calls the function which inject's a += emoji in the innerHTML.
I already have the emoji's unicode and everything, I'm missing the dynamic string function call that gets called once for example "I would like a" had already been written char by char, function gets called, emoji injected and it continues to write the string.