Commands - WebDriver 编辑

The following is a list of the available WebDriver commands.

Close Window
The Close Window command of the WebDriver API closes the current top-level browsing context (window or tab) and returns with the list of currently open WebWindows. If it is the last window that is being closed, the WebDriver session will implicitly be deleted. Subsequent commands after the session is ended will therefore cause invalid session ID errors.
Get Element Attribute
The Get Element Attribute command of the WebDriver API returns the attribute of the referenced web element. If for example the element is an img, the returned attribute is "//TODO", which is equivalent to calling Element.getAttribute on the element. For XML/XHTML documents it may be cased differently.
Get Element Property
The Get Element Property command of the WebDriver API returns the property of the referenced web element. Given <input value=foo> where the user changes the value to bar, the returned property is bar rather than the initial value foo. This is equivalent to calling Element.getProperty on the element.
Get Element Tag Name
The Get Element Tag Name command of the WebDriver API returns the tag name of the referenced web element. If for example the element is an img, the returned tag name is "IMG", which is equivalent to calling Element.tagName on the element. For XML/XHTML documents it may be cased differently.
Get Timeouts
The Get Timeouts command of the WebDriver API returns the timeouts associated with the current session. The session timeout durations control such behaviour as timeouts on script injection, document navigation, and element retrieval.
Get Window Handles
The Get Window Handles command of the WebDriver API returns a list of all WebWindows. Each tab or window, depending on whether you are using a tabbed browser, is associated by a window handle that is used as a reference when switching to the window.
Get Window Rect
The Get Window Rect command of the WebDriver API returns the size and position of the given WebElement. Many WebDriver clients present separate API methods for getting an element’s location and dimensions, but as an optimisation they both use this primitive.
New Window
The New Window command of the WebDriver API opens a new top-level browsing context of type window or tab, and returns with a dictionary containing the handle of the new WebWindow and its created type. If the requested type cannot be created by the browser, the alternative type will be tried to create.
Set Timeouts
The Set Timeouts command of the WebDriver API sets the timeouts associated with the current session. The session timeout durations control such behaviour as timeouts on script injection, document navigation, and element retrieval.
Set Window Rect
The Set Window Rect command of the WebDriver API alters the size and position of the operating system window associated with the current window. The command acts as the setter of Get Window Rect, which return object you can pass directly as this command’s payload.

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:122 次

字数:7021

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文