我需要單擊彈出窗口底部的“保存”按鈕。首先,我編寫了代碼以簡單地單擊“保存”按鈕,但出現(xiàn)異?!鞍粹o在點(diǎn) (869, 383) 處不可點(diǎn)擊”。好的,我想,我會(huì)滾動(dòng)到彈出窗口的底部,以便該按鈕可見并且可以單擊。我實(shí)現(xiàn)了向下滾動(dòng)到按鈕可見位置的代碼,但仍然出現(xiàn)異?!鞍粹o不可點(diǎn)擊”并且沒有點(diǎn)擊按鈕。請幫忙這是我的代碼//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();這是網(wǎng)頁中的元素:
1 回答

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