视频自动播放无尽循环

时间:2020-06-06 21:44:05

标签: selenium selenium-chromedriver opentest

如何检查主页中的视频是否为自动播放和无休止循环? 我需要在Open测试中使用的代码,可以是带有Java,JavaScript或python的硒

1 个答案:

答案 0 :(得分:0)

这篇文章需要更多信息,但是如果我假设您正在谈论HTML中的<video>,则可以执行以下操作。 (此示例在Python中)

# autoplay attribute doesn't have a value attached to it 
# so you'll have to find it with a css selector
try:
    # If it finds the element it is autoplay.
    video = driver.find_element_by_css_selector('video[autoplay]')
except:
     pass  # Video is not autoplay.