-5

Edit The problem can be solved using sned_keys() method of selenium driver.

I am developing a webwhatsapp spamming script and I want to do the following:

<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true"></div>

The things what we write between tag goes as input to whatsapp "send message" function.

I want to do

<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true">ABC</div>

How can I do that? I am new to python.

2 Answers 2

2

I would suggest go with some basic approach like,

String splitting/concat/using regex patterns. It may give you some basic idea of parsing strings etc..

Looking at your requirement, You may go for DOM/XML parsing modules like element tree/beautiful soap etc

Here is example with BeautifulSoup,

>>> soup = BeautifulSoup.BeautifulSoup('<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true">ABC</div>')
>>> t = soup.find('div')
>>> t
<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true">ABC</div>
>>> t.string = "PQR"
>>> t
<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true">PQR</div>
>>>
>>> str(t)
'<div class="input" contenteditable="true" data-tab="1" dir="auto" spellcheck="true">PQR</div>'
>>>
Sign up to request clarification or add additional context in comments.

2 Comments

It didin't work. Here's what is I'm trying to do. stackoverflow.com/questions/41409737/…
It worked using send_keys method of selenium driver. i was using wrong element to finf it. thanx by the way.
0

@Priyam Normally everyone do it using String Interpolation try it

1 Comment

,I am new to python.can you provide an simple code using above example.I want to enter ABC inside <div></div> tag.Thanx

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.