Python Forum
I am trying to send message in youtube live chat
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am trying to send message in youtube live chat
#1
Here I am trying to send message in youtube live chat.

Until login everything is working fine.

But I am unable to draw message in chat box and send it.

Help.

import contextlib
import time
import selenium.webdriver as webdriver
import selenium.webdriver.support.ui as ui
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By

chrome_path = r"\chromedriver.exe"
chrome_options = webdriver.ChromeOptions()
driver = webdriver.Chrome(chrome_path,chrome_options=chrome_options)

driver.get('https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Fhl%3Den%26feature%3Dcomment%26app%3Ddesktop%26next%3D%252Fall_comments%253Fv%253D6-S4et2YpZc%26action_handle_signin%3Dtrue&uilel=3&service=youtube&passive=true&hl=en')

wait = ui.WebDriverWait(driver, 30) # timeout after 10 seconds
inputEmail = driver.find_element_by_name('identifier')
inputEmail.send_keys('xxxxxx')
btSubmit = driver.find_element_by_xpath("//span[@class='RveJvd snByac']")
btSubmit.click()
inputPass = wait.until(lambda driver: driver.find_element_by_xpath("//input[@name='password']"))
inputPass.send_keys('xxxxxx')
time.sleep(5)
loginButton = wait.until(lambda driver: driver.find_element_by_xpath("//span[@class='RveJvd snByac']"))
loginButton.click()
time.sleep(20)


chatInput = driver.find_element_by_xpath("//*[@class='style-scope yt-live-chat-message-input-renderer'][5]")
chatInput.click()
chatInput.send_keys('xxxxxxx')
[Image: zdInn.png]
Reply
#2
Any errors?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  email Library: properly send message as quoted-printable malonn 3 1,338 Nov-14-2022, 09:31 PM
Last Post: malonn
  how to check if someone send a message in a discord channel? Zerolysimin 1 782 Nov-06-2022, 11:10 AM
Last Post: Larz60+
  Bluetooth send message after connecting? korenron 2 2,679 Apr-26-2021, 05:50 AM
Last Post: korenron
Question download watsapp chat Orliv 1 1,760 Jan-26-2021, 07:01 PM
Last Post: Larz60+
  How to send an error message Ewilliam51 1 2,057 Feb-15-2020, 08:41 AM
Last Post: ndc85430
  Chat bot akanowhere 16 5,889 Dec-12-2019, 02:47 PM
Last Post: akanowhere
  How can I send error message to slack using webhook url in Python? PrateekG 2 3,663 Jul-19-2018, 07:42 AM
Last Post: PrateekG
Sad Twitch Chat Bot - Disconnects after 10 minutes sp4wny 0 3,895 Dec-20-2017, 08:28 AM
Last Post: sp4wny
  Host and port problems for UDP chat server YevesDraco 2 3,820 May-07-2017, 04:35 PM
Last Post: YevesDraco
  Email - Send email using Windows Live Mail cyberzen 2 5,930 Apr-13-2017, 03:14 AM
Last Post: cyberzen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020