javascript - 跳过视频时间滑块 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>
试图操纵价值,但它不起作用。这是我的代码:
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);
解决方案
推荐阅读
- sql-server - 在 SSRS 中,从参数值动态插入目录表(报告服务器数据库)中的名称列
- php - 如果两个值都为零,则返回 0
- python - 如何从指定长度的张量创建一个和零的张量
- python - 如何将字典中的所有列表编号归零
- python - \n 循环后
- ios - Obj-C - UITextField 中的地址自动完成/搜索?
- java - 当程序运行其代码行时,有问题的数据数组在 Java 中使应用程序崩溃
- database - 在 MongoDB 中对集合的子组进行排序和限制的最佳方法是什么?
- javascript - (深色模式)添加“深色主题”后如何更改背景?
- shopify - 如何抓取一个产品属于哪个集合?