Refactor stats setup in main.py to improve element visibility handling and remove unnecessary pauses
This commit is contained in:
@@ -165,10 +165,9 @@ def setupStats(driver: webdriver.Chrome, url: str):
|
|||||||
|
|
||||||
wait.until(ec.presence_of_element_located((By.CLASS_NAME, 'vjs-big-play-button')))
|
wait.until(ec.presence_of_element_located((By.CLASS_NAME, 'vjs-big-play-button')))
|
||||||
actions.click(driver.find_element(By.CLASS_NAME ,'video-js')).perform()
|
actions.click(driver.find_element(By.CLASS_NAME ,'video-js')).perform()
|
||||||
actions.pause(2)
|
wait.until(ec.visibility_of_element_located((By.CLASS_NAME, 'vjs-control-bar')))
|
||||||
actions.context_click(driver.find_element(By.CLASS_NAME ,'video-js')).perform()
|
actions.context_click(driver.find_element(By.CLASS_NAME ,'video-js')).perform()
|
||||||
statsForNerds = driver.find_elements(By.CLASS_NAME ,'vjs-menu-item')
|
statsForNerds = driver.find_elements(By.CLASS_NAME ,'vjs-menu-item')
|
||||||
actions.pause(2)
|
|
||||||
actions.click(statsForNerds[-1]).perform()
|
actions.click(statsForNerds[-1]).perform()
|
||||||
wait.until(ec.text_to_be_present_in_element((By.CLASS_NAME, 'vjs-stats-list'), 'Player'))
|
wait.until(ec.text_to_be_present_in_element((By.CLASS_NAME, 'vjs-stats-list'), 'Player'))
|
||||||
logger.log(logging.INFO, 'Stats setup complete.')
|
logger.log(logging.INFO, 'Stats setup complete.')
|
||||||
|
Reference in New Issue
Block a user