Play & pause video using Selenium [closed]

不打扰是莪最后的温柔 提交于 2021-02-08 07:42:58

问题


My aim is to automate play/pause YouTube video present on the web page using selenium.

How to play/pause YouTube video with Java code for Selenium?


回答1:


I'm a cool guy so i'll post some code here.

driver.get("video link"); // open your browser at youtube video.

WebElement video = driver.findElement(By.id("id video")); // use the id of the video to find it

video.click(); // play the video

// implicite wait
//code .....

video.click(); // pause de video

With pracctice you'll add some conditions like if the video's lenghtbar is finish get another video else blablabla .



来源:https://stackoverflow.com/questions/16162291/play-pause-video-using-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!