gpt4 book ai didi

java - 在 Selenium 中使用带有水平滚动条的 WebTables

转载 作者:行者123 更新时间:2023-12-01 04:10:45 24 4
gpt4 key购买 nike

WebTable 嵌入到网页中以实现自动化。它有很多字段,因此有自己的水平滚动条(滚动条特定于 WebTable,而不是整个网页)。当我尝试交互/单击当前因滚动条而隐藏的 Web 元素时,会导致 NoSuchElementException/ElementNotVisibleException。

请让我知道如何处理/滚动 WebTable 的水平滚动条,使任何指定的元素可见。

最佳答案

您应该尝试下面的代码。这段代码对我有用。

WebElement elment = driver.findElemen(By.id("table_header"));
((JavascriptExecutor)driver).executeScript("arguments[0].click();", element);

关于java - 在 Selenium 中使用带有水平滚动条的 WebTables,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19955329/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com