Selenium clicked button but still getting error and exiting

22 Views Asked by At

so this is the code i was working on plz tell me where im wrong

from time import sleep
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains

options = webdriver.ChromeOptions()
options.add_extension('chrome.crx')

driver = webdriver.Chrome(options=options)
driver.set_script_timeout(30)
driver.get('https://uflix.to/mPlayer?movieid=lousy-carter-2024&stream=stream1')

# WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, 've-iframe')))
click = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#embed-player > div.main-content > div.play-btn')))
ActionChains(driver).move_to_element(click).click(click).perform()
# sleep(20)
WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.ID, 've-iframe')))
button = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'div[title="Embed Video"] button')))
driver.execute_script("arguments[0].click();", button)
alert = driver.switch_to.alert.text
print(alert)

if u guys are not able to open the devtools goto devtools before playing video and open source tab and search for block-inspection and block its request done now help me guys plz

0

There are 0 best solutions below