How can I type text in javascript?
Background-Info
I'm trying to create a python selenium bot to comment on various TikTok posts. Now the issue is when trying to comment on the post, it won't let you insert text because the comment box isn't an input
element but a DIV
element. I am aware you can edit the span
value that's inside of the DIV
with javascript but if you interact with it using code it won't let me leave mentions or tagging people. All of this was discussed here but I didn't get any feedback from anyone and this is a separate question so that's why I made a second post.
My issue
So after some thinking, I think I found a solution. So originally I was using pyautogui
to just type the text I needed so I could mention people. So I thought "what if I get this working but with javascript because you can call javascript functions with selenium". So I was wondering how I could make javascript type on a webpage.
What I've tried
I've tried
document.write('')
but the issue with this, is that it just clears the entire page and only shows the value providedI tried researching my question but was unable to find anything
My goal
My goal is to simply be able to type text with java script, I don't want to update a value I want to simulate keystrokes.