videoPlayer=self.driver.find_element_by_tag_name(“video”)#获取到video标签
#currenttSrc属性获取视频文件的网络存储地址
videoSrc=self.driver.execute_script(“return arguments[0].currentSrc;”,videoPlayer)
#duration属性获取视频文件的播放时长
videoDuration=self.driver.execute_script(“return arguments[0].duration;”,videoPlayer)
#使用JavaScript,通过调用播放器内部的play()方法播放影片
self.driver.execute_script(“return arguments[0].play();”,videoPlayer)
#通过调用播放器的内部函数pause函数来暂停播放影片
self.driver.execute_script(“return arguments[0].pause();”,videoPlayer)
#将暂停的视频页面进行截屏
self.driver.save_screenshot(“d:\\videoPlay.png”)