I am having a python
selenium
script where I am trying to send messages to different users in Telegram
.
To open any user's page we just need the user's username and we can load its chat page.
web = webdriver.Chrome()
web.get(TELEGRAM_WEB_HOMEPAGE)
nameList = get_active_name_list()
for name in nameList:
web.get(USER_URL + name)
web.implicitly_wait(2) #HERE IS THE WAIT
elem = web.find_element_by_class_name('composer_rich_textarea')
elem.click()
elem.send_keys(MESSAGE)
elem.send_keys(Keys.ENTER)
new_nameList.remove(name)
I also tried with time.sleep(2)
, in all cases the program freezes once it reaches the wait command. And I need to wait for the url
of next user
to load.
I also tried using WebDriverWait
as mentioned here.
So, how to solve the problem?