From 65c748866abbe72d719fd304e4e28a9dc0f200c5 Mon Sep 17 00:00:00 2001 From: Eljakim Herrewijnen Date: Wed, 27 Jul 2022 22:40:21 +0200 Subject: [PATCH] Fixed full screen mode and disabled chrome message about automated test software --- streamer.py | 2 ++ streaming/youtube.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/streamer.py b/streamer.py index 7dfb943..a1b76f4 100644 --- a/streamer.py +++ b/streamer.py @@ -34,6 +34,8 @@ class Streamer: self.options = Options() self.options.add_argument("start-maximized") self.options.add_experimental_option("detach", True) + self.options.add_experimental_option("useAutomationExtension", False) + self.options.add_experimental_option("excludeSwitches",["enable-automation"]) self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=self.options) #implicit wait TODO add as config diff --git a/streaming/youtube.py b/streaming/youtube.py index 2940425..8cfa600 100644 --- a/streaming/youtube.py +++ b/streaming/youtube.py @@ -51,16 +51,17 @@ class Web_Youtube(Web_StreamService): def post_load_actions(self, driver): self.bypass_cookies(driver) - # self.double_click_fullscreen(driver) does not work + self.double_click_fullscreen(driver) def double_click_fullscreen(self, driver): while True: if len(driver.find_elements(by=By.XPATH, value='//*[@id="movie_player"]/div[1]/video')) > 0: video = driver.find_elements(by=By.XPATH, value='//*[@id="movie_player"]/div[1]/video')[0] break - time.sleep(5) - action = ActionChains(driver) + action = ActionChains(driver) action.double_click(video) + action.perform() + # action.send_keys("f") # video.click();time.sleep(.1);video.click() def bypass_cookies(self, driver):