简体   繁体   中英

How do I fast forward (scrub) through a video using selenium python?

So far, I was able to use the below to play the video. but I want to scrub the video to the end in order to end the season and move on the next page. how do I do that?

video = driver.find_element_by_id("mainVideo_html5_api")
driver.execute_script("arguments[0].click();", video)

I found this one method that could be done on the console but it doesn't work in selenium.

var vid = document.getElementById("mainVideo_html5_api")
var duration = vid.duration;
vid.currentTime = vid.duration;

Just use pyautogui to press the arrow keys.

import pyautogui
import time 

while True:
     pyautogui.press("right")
     time.sleep(enter how many seconds in between each press.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM