Jun-08-2019, 07:43 AM
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.
Until login everything is working fine.
But I am unable to draw message in chat box and send it.
Help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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) 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]](https://i.stack.imgur.com/zdInn.png)