Javascript 跳过视频时间滑块

Javascript 跳过视频时间滑块,javascript,selenium-webdriver,Javascript,Selenium Webdriver,我正在尝试使用selenium将视频快进一段时间。HTML标记如下所示: <span class="mejs-time-total mejs-time-slider" style="width: 895px;" aria-label="Time Slider" aria-valuemin="0" aria-valuemax="83.733333" aria-valuenow="4.22" aria-valuetext="00:04" role="slider" tabindex="0" a

我正在尝试使用selenium将视频快进一段时间。HTML标记如下所示:

<span class="mejs-time-total mejs-time-slider" style="width: 895px;" aria-label="Time Slider" aria-valuemin="0" aria-valuemax="83.733333" aria-valuenow="4.22" aria-valuetext="00:04" role="slider" tabindex="0" aria-hidden="true">
    <span class="mejs-time-buffering" style="display: none;"></span>
    <span class="mejs-time-loaded" style="width: 269.633px;"></span>
    <span class="mejs-time-current" style="width: 45px;"></span>
    <span class="mejs-time-handle" style="left: 38px;"></span>
    <span class="mejs-time-float" style="display: none;">
        <span class="mejs-time-float-current">00:00</span>
        <span class="mejs-time-float-corner"></span>
    </span>
</span>
<span class="mejs-time-current" style="width: 45px;"></span>

您好,看起来纯HTML不足以重现问题:您添加的代码片段不包含任何视频。请添加缺少的部分,以便其他人可以提供帮助。最好的回复是发布一个链接到一个示例页面,该页面包含一个视频,其中包含您试图操纵的控件。
WebElement element = context.getDriver()
    .findElement(By.xpath("//*[@class='mejs-time-total mejs-time-slider']"));
JavascriptExecutor executor = (JavascriptExecutor) getContext().getDriver();
executor.executeScript("arguments[0].setAttribute('width', '240');", element);