Skip to content
Advertisement

Tag: getelementsbyclassname

write get.ElementByClass() from nested div to file

I’m working on a chatbot where users can talk to the chatbot and I would like to have the conversation logged into a text file. I was thinking grabbing the <div class=”msg-text”>, which represent the conversation the document.getElementByClass(“msg-text”)[0].innerText; which is the chatbot’s response and the document.getElementByClass(“msg-text”)[1].innerText; which is the user’s response and have it to be read into a file.

Advertisement