我正在尝试使用硒快进视频。 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>
试图操纵该值,但不起作用。这是我的代码:
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);