Answer the question
In order to leave comments, you need to log in
Tik tok stream not loading, how to fix it?
With the help of selenium, I went to the Tik tok broadcast, the task is to leave a comment using selenium, but the stream does not load, it also does not find the field for entering a message
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
options = webdriver.ChromeOptions()
#options.add_argument('--headless')
user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2'
options.add_argument('--disable-blink-featuresAutomationControlled')
options.add_argument(f'user-agent={user_agent}')
driver = webdriver.Chrome(options=options)
driver.get('https://www.tiktok.com/@juliansss_2002/live')#ccылка на трансляцию
sleep(5)
iframe = driver.find_element(By.XPATH,'//iframe[@class="tiktok-tpndsz-IframeLoginSite eaxh4gs3"]')
sleep(3)
driver.switch_to.frame(iframe)
vk_login = driver.find_elements(By.XPATH,'//div[@class="channel-name-2qzLW"]')[2].click()
driver.switch_to.window(driver.window_handles[1])
email = driver.find_element(By.NAME,'email')
email.clear()
email.send_keys('Your mail')
sleep(1)
password = driver.find_element(By.NAME,'pass')
password.clear()
password.send_keys('Your pass',Keys.ENTER)
sleep(3)
driver.switch_to.window(driver.window_handles[0])
sleep(10)
comm = driver.find_element(By.XPATH,'//div[@class="public-DraftEditorPlaceholder-inner"]')
comm.send_keys('text')
Answer the question
In order to leave comments, you need to log in
I found a solution, if anyone needs it, just need to change the user-agent to 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.0 Safari/537.36 (compatible; Yeti/1.1 ; + naver.me/spd )'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question