我需要單擊彈出窗口底部的“保存”按鈕。首先,我編寫了代碼以簡單地單擊“保存”按鈕,但出現異?!鞍粹o在點 (869, 383) 處不可點擊”。好的,我想,我會滾動到彈出窗口的底部,以便該按鈕可見并且可以單擊。我實現了向下滾動到按鈕可見位置的代碼,但仍然出現異?!鞍粹o不可點擊”并且沒有點擊按鈕。請幫忙這是我的代碼//To scroll down to the bottom of pop up windowIJavaScriptExecutor down = (IJavaScriptExecutor)driver;down.ExecuteScript("arguments[0].scrollTop = arguments[1];", driver.FindElement(By.Id("move_In")), 1000); //Click Save button driver.FindElement(By.XPath("//button[contains(.,'Save')]")).Click();這是網頁中的元素:
1 回答

偶然的你
TA貢獻1841條經驗 獲得超3個贊
這是在 Java 中使用 javascript 單擊按鈕的方法,我確定它在 C# 中非常相似
WebElement button = driver.findElement(By.id("someid"));
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("arguments[0].click();", button);
- 1 回答
- 0 關注
- 229 瀏覽
添加回答
舉報
0/150
提交
取消