0

I have problems when I pass a string to send_keys that contains HTML. It all shifts. For example <tag>abc</tag>def becomes <tag>c</tagdef>. The text-field is described by:

<textarea maxlength="4000" id="some-id" rows="3" name="data[a][b]" class="a-form-normal" dir="auto" spellcheck="true"></textarea>

I don't really understand what happens and how I can avoid it. I normally pass my html-string with: description = '<tag>abc</tag>def' browser.find_element_by_id('some-id).send_keys(description) This results in the strange shifts, described above.

Instead I tried to paste the string instead:

os.system("echo %s| clip" % description.strip())
browser.find_element_by_id('some-id').send_keys(Keys.CONTROL,'v')

Then I get the error message: Syntax error: redirection unexpected

I am using Python 3.7 on a Raspberry Pi

Many thanks for your help

2
  • Could you add the html of the text field this text is being sent too? Commented Jan 22, 2020 at 20:47
  • @Jortega added <textarea maxlength="4000" id="some-id" rows="3" name="data[a][b]" class="a-form-normal" dir="auto" spellcheck="true"></textarea> Commented Jan 22, 2020 at 20:57

1 Answer 1

2

Got it solved by using a different way to copy to clipboard:

import pyperclip

description = '<tag>abc</tag>def'
pyperclip.copy(description)
browser.find_element_by_id('some-id').send_keys(Keys.CONTROL,'v')

But a way without clipboard is still missing ...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.