简体   繁体   English

如何处理在网页上滚动时出现的硒中的表单?

[英]How to handle form in selenium which is coming while scrolling on webpage?

滚动时出现表单,我需要在该表单中发送搜索数据并单击提交。

You can use Actions class to scroll down to that item.您可以使用Actions类向下滚动到该项目。 sample code:示例代码:

WebElement element = driver.findElement(By.id("my-id"));
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.perform();

you can make use of javascriptexecutor to scroll element into view您可以使用 javascriptexecutor 将元素滚动到视图中

JavascriptExecutor js =(JavascriptExecutor)driver;
js.executeScript("arguments[0].scrollIntoView(true);",element);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何处理硒webdriver中的弹出窗口(不警报)? - how to handle popup in selenium webdriver (which is not alert)? 如何接受不同窗口中出现的硒警报? - How to accept alert in selenium which is coming up in a different window? 如何处理不是来自Struts 2中JSP的Action表单数据? - How to handle Action's form data that is not coming from JSP in Struts 2? 如何在提供网页请求时识别哪些方法正在吃饭? - How to identify which methods are eating time while serving request for a webpage? selenium - 通用 function 使用嵌套的linkedhashmap在网页中输入测试数据 - 如何处理单选按钮 - selenium - generic function to enter test data in webpage using nested linkedhashmap - how to handle radio buttons 如何在 html 标签中不存在元素时处理 Selenium findElements - How to handle Selenium findElements while elements is not present in html tag Websocket(Jetty):如何处理服务器端分块的二进制数据 - Websocket(Jetty) : How to handle the binary data on server side which is coming in chunks 测试时在 selenium webdriver 中隐藏网页 - hide the webpage in selenium webdriver while testing 如何处理 selenium 脚本以验证使用 selenium webdriver 需要 20 分钟的报告的完成情况? - how to handle the selenium script to validate the completion of report which takes 20 minutes using selenium webdriver? 如何使用Java来解析Selenium Webdriver中所有元素的网页,该网页会定期连续刷新4秒钟? - How to parse all the elements in Selenium Webdriver using Java for a webpage which is continously refreshing for 4 seconds periodically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM