79826658

Date: 2025-11-21 15:08:14
Score: 3.5
Natty:
Report link

# Source - https://stackoverflow.com/a/55561751

# Posted by David Silveiro, modified by community. See post 'Timeline' for change history

# Retrieved 2025-11-21, License - CC BY-SA 4.0

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()

driver.maximize_window()

wait = WebDriverWait(driver, 3)

presence = EC.presence_of_element_located

visible = EC.visibility_of_element_located

# Navigate to url with video being appended to search_query

driver.get('https://www.youtube.com/results?search_query={}'.format(str(video)))

# play the video

wait.until(visible((By.ID, "video-title")))

driver.find_element(By.ID,

"video-title").click()

Reasons:
  • Blacklisted phrase (1): youtube.com
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Bijay Boy