Fixed full screen mode and disabled chrome message about automated test software

This commit is contained in:
Eljakim Herrewijnen 2022-07-27 22:40:21 +02:00
parent 58d538183b
commit 65c748866a
2 changed files with 6 additions and 3 deletions

View File

@ -34,6 +34,8 @@ class Streamer:
self.options = Options() self.options = Options()
self.options.add_argument("start-maximized") self.options.add_argument("start-maximized")
self.options.add_experimental_option("detach", True) 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) self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=self.options)
#implicit wait TODO add as config #implicit wait TODO add as config

View File

@ -51,16 +51,17 @@ class Web_Youtube(Web_StreamService):
def post_load_actions(self, driver): def post_load_actions(self, driver):
self.bypass_cookies(driver) self.bypass_cookies(driver)
# self.double_click_fullscreen(driver) does not work self.double_click_fullscreen(driver)
def double_click_fullscreen(self, driver): def double_click_fullscreen(self, driver):
while True: while True:
if len(driver.find_elements(by=By.XPATH, value='//*[@id="movie_player"]/div[1]/video')) > 0: 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] video = driver.find_elements(by=By.XPATH, value='//*[@id="movie_player"]/div[1]/video')[0]
break break
time.sleep(5)
action = ActionChains(driver) action = ActionChains(driver)
action.double_click(video) action.double_click(video)
action.perform()
# action.send_keys("f")
# video.click();time.sleep(.1);video.click() # video.click();time.sleep(.1);video.click()
def bypass_cookies(self, driver): def bypass_cookies(self, driver):