簡體   English   中英

如何處理在網頁上滾動時出現的硒中的表單?

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

滾動時出現表單,我需要在該表單中發送搜索數據並單擊提交。

您可以使用Actions類向下滾動到該項目。 示例代碼:

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

您可以使用 javascriptexecutor 將元素滾動到視圖中

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM