我只想知道通过Action类点击webelement和直接点击有什么区别
假设我们在网页上有一个 button1
Actions action = new Actions(_driver);
action.MoveToElement(driver.FindElement(By.Id("button1")));
action.Click().Build().Perform();
VS
driver.FindElement(By.Id("button1").Click();
以上两种说法有什么区别。
谢谢
最佳答案
您是否考虑过阅读 documentation ?
Actions类:
The user-facing API for emulating complex user gestures. Use this class rather than using the Keyboard or Mouse directly.
特别是 click方法:
Clicks at the current mouse location.
而 WebDriver.click方法:
Click this element. If this causes a new page to load, this method will attempt to block until the page has loaded.
关于c# - 直接点击元素与通过 Action 类点击元素的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28600313/