-
Notifications
You must be signed in to change notification settings - Fork 19
Object Model Overview
Below is an overview of the SeleniumVBA Object Model. See the Wiki Home for usage topics.
This class is used for object instantiation when referencing SeleniumVBA externally from another code project. It is not needed if referencing SeleniumVBA from within the same project or when using the twinBASIC ActiveX DLL solution. Example usage:
Dim driver As SeleniumVBA.WebDriver
Set driver = SeleniumVBA.New_WebDriver
Class | Method/Property | Description |
---|---|---|
ClassFactory | New_WebCookie | Instantiates a WebCookie object |
ClassFactory | New_WebDriver | Instantiates a WebDriver object |
ClassFactory | New_WebDriverManager | Instantiates a WebDriverManager object |
ClassFactory | New_WebElements | Instantiates a WebElements object |
ClassFactory | New_WebJsonConverter | Instantiates a WebJsonConverter object - this is optional as this object is predeclared |
ClassFactory | New_WebKeyboard | Instantiates a WebKeyboard object - this is optional as this object is predeclared |
ClassFactory | New_WebPrintSettings | Instantiates a WebPrintSettings object |
This class is used to emulate a human interaction sequence with the webpage. A WebActionChain object must be instantiated using WebDriver's ActionChain method. To execute the chain, use the Perform method. Example usage:
Dim actions as WebActionChain
...
Set actions = driver.ActionChain
actions.KeyDown(keys.ShiftKey).SendKeys("upper case").KeyUp(keys.ShiftKey)
actions.MoveToElement(elem).Click().Perform
Class | Method/Property | Description |
---|---|---|
WebActionChain | AltShiftKey | Sends a Alt-Shift-[Key] sequence to focused element |
WebActionChain | Clear | Clears the focused element's text field |
WebActionChain | Click | Clicks an element |
WebActionChain | ClickAndHold | Holds down the left mouse button on an element |
WebActionChain | ClickContext | Performs a context-click (right click) on an element |
WebActionChain | CtrlAltKey | Sends a Ctrl-Alt-[Key] sequence to focused element |
WebActionChain | CtrlKey | Sends a Ctrl-[Key] sequence to focused element |
WebActionChain | CtrlShiftKey | Sends a Ctrl-Shift-[Key] sequence to focused element |
WebActionChain | DoubleClick | Double-clicks an element |
WebActionChain | DragAndDrop | Holds down the left mouse button on the source element, then moves to the target element and releases the mouse button |
WebActionChain | DragAndDropByOffset | Holds down the left mouse button on the source element, then moves to the target offset and releases the mouse button |
WebActionChain | DragAndDropToPosition | Holds down the left mouse button on the source element, then moves to the x and y offsets |
WebActionChain | KeyDown | Sends a key press only, without releasing it. Should only be used with modifier keys (Ctrl, Alt, and Shift) |
WebActionChain | KeyUp | Releases a modifier key |
WebActionChain | MoveByOffset | Moves the mouse to an offset from current mouse position - if element is specified, then moves the mouse by an offset relative to the top-left corner of the element |
WebActionChain | MoveToElement | Moves the mouse to the middle of an element |
WebActionChain | MoveToXY | Moves the mouse pointer to (x,y) relative to viewport origin (top-left) |
WebActionChain | Perform | Executes the action chain |
WebActionChain | ReleaseButton | Releases a held mouse button on an element |
WebActionChain | ResetActions | Resets the action queue and key/pointer states on both the local and remote ends |
WebActionChain | ScrollBy | Scrolls window by x and y offsets |
WebActionChain | ScrollToElement | Scrolls to element position with optional x and y offsets |
WebActionChain | SendKeys | Sends key sequence to current focused element (see WebKeyboard class for special keys support) |
WebActionChain | SetFocus | Sets the focus on the given element for key input - note this clicks the element - for focus without clicking, see SetFocus method of WebDriver/WebElement classes |
WebActionChain | ShiftKey | Sends a Shift-[Key] sequence to focused element |
WebActionChain | Wait | Pauses execution for time in milliseconds |
Automated interaction with alerts is facilitated by the WebAlert class, which has methods for accepting, dismissing, sending keys, and retrieving the alert message. The WebAlert object is instantiated via the SwitchToAlert method of the WebDriver class. The SwitchToAlert method waits a user-specified maximum amount of time via the maxWaitTimeMS argument (default 10 secs) for an expected alert to show, and then returns a WebAlert object for subsequent interaction. Example usage:
'SwitchToAlert waits for alert to show, up to a maximum wait time (default 10 seconds), and returns a WebAlert object.
'The WebAlert object can be used to accept, dismiss, get alert prompt text, and send keys to a prompt alert.
driver.SwitchToAlert.SendKeys("hola mi nombre es Jose").Accept
Class | Method/Property | Description |
---|---|---|
WebAlert | Accept | Accepts the active alert |
WebAlert | Dismiss | Dismisses the active alert |
WebAlert | GetText | Returns the prompt text of the active alert |
WebAlert | SendKeys | Sends the specified text to the active prompt-type alert - Selenium special keys not recognized for alerts |
This class is used to manage/set Selenium optional Capabilities. A WebCapabilities object must be instantiated using WebDriver's CreateCapabilities method, after "starting" the WebDriver. The modified WebCapabilities object is passed to the WebDriver's OpenBrowser method. Example usage:
Dim caps as WebCapabilities
...
driver.StartEdge
Set caps = driver.CreateCapabilities
caps.RunIncognito = True
driver.OpenBrowser caps
Class | Method/Property | Description |
---|---|---|
WebCapabilities | AddArguments | Adds a list of option arguments |
WebCapabilities | AddExcludeSwitches | Adds a list of option excludeSwitches |
WebCapabilities | AddExtensions | Adds a list of option extensions |
WebCapabilities | AddLocalStateFlags | Adds a list of experimental browser flags (edge://flags, chrome://flags). Flags must end in @0 (default), @1 (enable), or @2 (disable) |
WebCapabilities | AddWindowTypes | Adds a list of option windowTypes |
WebCapabilities | Dictionary | Returns a capabilities Dictionary object |
WebCapabilities | LoadFromFile | Loads the capabilities from file path |
WebCapabilities | RemoveControlNotification | Removes control notification for Edge/Chrome |
WebCapabilities | RunIncognito | Runs incognito/private argument mode |
WebCapabilities | RunInvisible | Runs headless argument mode |
WebCapabilities | SaveToFile | Saves the capabilities to file path |
WebCapabilities | SetAcceptInsecureCerts | Sets the acceptInsecureCerts capability |
WebCapabilities | SetBrowserBinary | Sets the path to the browser executable in a non-standard location |
WebCapabilities | SetCapability | Sets a generic capability |
WebCapabilities | SetDebuggerAddress | Sets the Debugger Address option for Edge/Chrome needed to connect with an already existing browser |
WebCapabilities | SetDetachBrowser | Sets the detach option for Edge/Chrome |
WebCapabilities | SetDownloadPrefs | Sets auto-download preferences and directory path |
WebCapabilities | SetGeolocationAware | Sets whether or not to allow geolocation awareness |
WebCapabilities | SetOption | Sets an option key/value |
WebCapabilities | SetPageLoadStrategy | Sets the pageLoadStrategy capability - defaults to normal |
WebCapabilities | SetPreference | Sets an option preference key/value |
WebCapabilities | SetProfile | Sets a user-defined profile path |
WebCapabilities | SetUnhandledPromptBehavior | Sets the unhandledPromptBehavior capability - defaults to dismiss and notify |
WebCapabilities | SetUserAgent | Sets the user agent string |
WebCapabilities | ToJson | Returns Json string for qc |
This class is used to manage/modify a cookie object. Use in conjunction with the WebDriver object's GetCookie, SetCookie, DeleteCookie methods.
Class | Method/Property | Description |
---|---|---|
WebCookie | Domain | Specifies name of the domain to associate the cookie with. The default value is the current domain |
WebCookie | ExpiryDate | Gets or sets the expiration date and time (Date format) for the cookie |
WebCookie | ExpiryUnix | Gets or sets the expiration date and time (Unix format) for the cookie |
WebCookie | HttpOnly | Indicates whether the cookie has to be used only over HTTP or not. True if the cookie has the HttpOnly attribute and cannot be accessed through a client-side script; otherwise, false. The default is false |
WebCookie | Name | Gets or sets the name of the cookie |
WebCookie | Path | Gets or sets the virtual path to transmit with the cookie. The default is /, which is the server root |
WebCookie | SameSite | Attribute to let servers specify whether/when cookies are sent with cross-site requests. Values are Strict, Lax (default), and None |
WebCookie | Secure | Indicates whether the cookie can only be sent to the server over a secure HTTPS connection. The default value is false |
WebCookie | ToDictionary | Returns the cookie as a Dictionary object |
WebCookie | Value | Gets or sets the value of the cookie |
This class is used to manage a collection of cookie objects. It must be instantiated using WebDriver's CreateCookies method. Use this class in conjunction with the WebDriver object's SetCookies and DeleteAllCookies methods. Example usage:
Dim cookies as WebCookies
...
Set cookies = driver.CreateCookies
Class | Method/Property | Description |
---|---|---|
WebCookies | Add | Adds a cookie to the collection |
WebCookies | Count | Returns the number of cookies in the collection |
WebCookies | Item | Returns the cookie of the provided index |
WebCookies | LoadFromFile | Loads the cookie collection from a file path |
WebCookies | Remove | Removes a cookie corresponding to the given index |
WebCookies | RemoveAll | Removes all member cookie objects from the collection |
WebCookies | SaveToFile | Saves the cookie collection to a file path |
WebCookies | Size | Returns the number of cookies in the collection |
This class provides the main mechanism to control/automate a browser application. SeleniumVBA supports Chrome, MS Edge, Firefox, and IE emmulation mode. Example usage:
Dim driver As New WebDriver
driver.StartEdge 'starts a driver
driver.OpenBrowser 'opens a browser for navigation
driver.NavigateTo "https://www.wikipedia.org/"
driver.Wait 1000
'do some more things
driver.CloseBrowser 'close the browser
driver.Shutdown 'quit the driver
Class | Method/Property | Description |
---|---|---|
WebDriver | ActionChain | Creates an initialized action chain object |
WebDriver | ActiveWindow | Returns the active WebWindow object |
WebDriver | Clear | Clears the text field of the element |
WebDriver | Click | Clicks the element. If element not specified, then clicks on the active element |
WebDriver | CloseBrowser | Closes browser without terminating driver instance |
WebDriver | CommandWindowStyle | Set the driver command window display mode - defaults to vbHide |
WebDriver | CreateCapabilities | Creates a capabilities object - must be performed after initializing the driver using one of the Start* methods |
WebDriver | CreateCookies | Creates a cookies object - must be performed after initializing the driver using one of the Start* methods |
WebDriver | CreateSettingsFile | Creates/updates the optional INI settings file - set keepExistingValues to False to reset existing settings to system defaults |
WebDriver | DefaultDriverFolder | Sets/Gets the default Selenium driver folder |
WebDriver | DefaultIOFolder | Sets/Gets the default input/output folder |
WebDriver | DeleteAllCookies | Deletes all cookies |
WebDriver | DeleteCookie | Deletes a cookie having the specified name |
WebDriver | DeleteFiles | Deletes a list of files |
WebDriver | DeSelectAll | Deselects all dropdown option elements |
WebDriver | DeSelectByIndex | Deselects a dropdown option element with the specified index |
WebDriver | DeSelectByValue | Deselects the dropdown option element having the specified value attribute |
WebDriver | DeSelectByVisibleText | Deselects the dropdown option element having the specified visible text |
WebDriver | DownloadResource | Downloads a resource (such as an image) contained in an element attribute to a file or folder path - if a folder is specified, then the file will inherit the name of the source |
WebDriver | DragAndDrop | Drags and drops the element to the specified target element |
WebDriver | ExecuteCDP | Executes a CDP command and returns a dictionary response. Pass command parameters with either a JSON string or a Dictionary object. |
WebDriver | ExecuteCmd | Sends a command and parameters to the Selenium WebDriver and returns a dictionary response. Arguments (such as sessionId) in the command path must be preceeded by a $ character. If the command has parameters, pass either a JSON string or a Dictionary object. |
WebDriver | ExecuteScript | Executes a java script synchronously |
WebDriver | ExecuteScriptAsync | Executes a java script asynchronously |
WebDriver | FindElement | Finds the first element for a given selector and value |
WebDriver | FindElementByClassName | Finds the first element by the specified class name value |
WebDriver | FindElementByCssSelector | Finds the first element by the specified css selector value |
WebDriver | FindElementByID | Finds the first element by the specified id value |
WebDriver | FindElementByLinkText | Finds the first element by the specified link text value |
WebDriver | FindElementByName | Finds the first element by the specified name value |
WebDriver | FindElementByPartialLinkText | Finds the first element by the specified partial link text value |
WebDriver | FindElementByTagName | Finds the first element by the specified tag name value |
WebDriver | FindElementByXPath | Finds the first element by the specified xpath query value |
WebDriver | FindElementFromShadowRoot | Finds the first element in the shadow root for a given selector and value |
WebDriver | FindElements | Finds all elements that satisfy the specified selector and value |
WebDriver | FindElementsByClassName | Finds all elements that satisfy the specified class name value |
WebDriver | FindElementsByCssSelector | Finds all elements that satisfy the specified css selector value |
WebDriver | FindElementsByID | Finds all elements that satisfy the specified id value |
WebDriver | FindElementsByLinkText | Finds all elements that satisfy the specified link text value |
WebDriver | FindElementsByName | Finds all elements that satisfy the specified name value |
WebDriver | FindElementsByPartialLinkText | Finds all elements that satisfy the specified partial link text value |
WebDriver | FindElementsByTagName | Finds all elements that satisfy the specified tag name value |
WebDriver | FindElementsByXPath | Finds all elements that satisfy the specified xpath query value |
WebDriver | FindElementsFromShadowRoot | Finds all elements in the shadow root for a given selector and value |
WebDriver | GetActiveElement | Returns the active element |
WebDriver | GetAllCookies | Returns the collection of cookies for the current webpage |
WebDriver | GetAllSelectedOptions | Returns all selected option elements for the specified dropdown element |
WebDriver | GetAriaLabel | Gets the Arial label of the element |
WebDriver | GetAriaRole | Gets the Arial role of the element |
WebDriver | GetAttribute | Gets the specified attribute of the element |
WebDriver | GetBrowserName | Gets the browser name |
WebDriver | GetChildElements | Returns the direct descendant child elements of the element |
WebDriver | GetCookie | Returns a cookie having the specified name |
WebDriver | GetCSSProperty | Gets the specified CSS property of the element |
WebDriver | GetCurrentFrameName | Returns the name of the active frame |
WebDriver | GetCurrentUrl | Returns the current url string |
WebDriver | GetDriverStatus | Returns a dictionary holding various info about the driver |
WebDriver | GetElementId | Returns the Id string of the specified element object - useful for testing purposes |
WebDriver | GetGeolocation | Gets geolocation parameter values as a dictionay object |
WebDriver | GetInnerHTML | Gets the inner HTML of the element |
WebDriver | GetOuterHTML | Gets the outer HTML of the element |
WebDriver | GetPageSource | Returns the current webpage source as a string |
WebDriver | GetParentElement | Returns the parent of element |
WebDriver | GetProperty | Gets the property state of the element, such as the value of an input box - if the property does not exist, then it returns vbNullString |
WebDriver | GetRect | Returns a dictionary containing x, y, width, height, left, top, right, and bottom of the element's rectangle |
WebDriver | GetScrollHeight | Gets the height of the current scrollable window or element content |
WebDriver | GetScrollWidth | Gets the width of the current scrollable window or element content |
WebDriver | GetSelectedOption | Returns the first selected option element for the specified dropdown element |
WebDriver | GetSessionsInfo | Returns a dictionary holding various info about the session |
WebDriver | GetShadowRoot | Gets the shadow root hosted by the element |
WebDriver | GetTagName | Gets the tag name of the element |
WebDriver | GetText | Gets the text of the element - set optional visibleOnly to False to return text whether hidden or not |
WebDriver | GetUserAgent | Returns the user agent string - must be called after OpenBrowser |
WebDriver | GoBack | Simulates clicking the back arrow on the browser window |
WebDriver | GoForward | Simulates clicking the forward arrow on the browser window |
WebDriver | HasAttribute | Returns a boolean indicating if the element has the specified attribute |
WebDriver | HasFocus | Returns a boolean indicating if the specified element has the focus |
WebDriver | HasProperty | Returns a boolean indicating if the current element has the specified property |
WebDriver | ImplicitMaxWait | Sets/Gets how long to wait for the element location strategy to complete when locating an element(s) |
WebDriver | InstallAddon | Installs a browser addon (extension) such as an an .xpi file - Firefox only |
WebDriver | IsAlertPresent | Returns a boolean indicating whether an active alert is present |
WebDriver | IsDisplayed | Returns a boolean indicating if the element is displayed |
WebDriver | IsEnabled | Returns a boolean indicating if the element is enabled |
WebDriver | IsMultiSelect | Returns a boolean indicating if the element is a multi-select dropdown |
WebDriver | IsPageFound | Checks if the current url is equal to the specified url |
WebDriver | IsPresent | Returns a boolean indicating if the element is present. User can optionally set an implicit wait, and obtain a reference to the found element. |
WebDriver | IsSelected | Returns a boolean indicating if the dropdown option element is selected |
WebDriver | NavigateTo | Navigates browser to a specified webpage and returns true if no timeout or other error |
WebDriver | NavigateToFile | Navigates browser to an html file of the specified file path |
WebDriver | OpenBrowser | Opens browser instance with specified capabilities |
WebDriver | PageLoadTimeout | Sets/Gets the timeout limit used to interrupt a navigation attempt |
WebDriver | PageToHTMLDoc | Converts webpage to an html document object - use sanitize to remove online dynamic content while leaving the dom tree intact |
WebDriver | PageToHTMLFile | Converts webpage to an html file - use sanitize to remove online dynamic content while leaving the dom tree intact |
WebDriver | PageToJSONFile | Converts webpage to a json file |
WebDriver | PageToJSONObject | Converts webpage to a json dictionary or collection object |
WebDriver | PageToString | Returns the current webpage source as a string |
WebDriver | PageToXMLDoc | Converts webpage to an xml document object |
WebDriver | PageToXMLFile | Converts webpage to an xml file |
WebDriver | PrintToPDF | Prints the current webpage window to a specified pdf file path |
WebDriver | QuerySelector | Finds the first element by the specified css selector value |
WebDriver | QuerySelectorAll | Finds all elements that satisfy the specified css selector value |
WebDriver | Refresh | Refreshes the current url |
WebDriver | ResolvePath | Returns a fully qualified path for the input path |
WebDriver | SaveBase64StringToFile | Saves a base 64 encoded string to a file in binary format |
WebDriver | SaveScreenshot | Saves a screenshot of the active browser window to a file |
WebDriver | SaveStringToFile | Saves a specified string to a file |
WebDriver | ScriptTimeout | Sets/Gets how long to wait to interrupt a script that is being evaluated |
WebDriver | ScrollBy | Scrolls by an x-y offset in pixels relative to the current scrollable window or element content position |
WebDriver | ScrollIntoView | Scrolls the element specified into the visible viewport |
WebDriver | ScrollTo | Scrolls to an x-y position in pixels relative to the current scrollable window or element content origin |
WebDriver | ScrollToBottom | Scrolls to the bottom of current scrollable window or element content |
WebDriver | ScrollToTop | Scrolls to the top of current scrollable window or element content |
WebDriver | SelectAll | Selects all multi-select dropdown option elements |
WebDriver | SelectByIndex | Selects a dropdown option element with the specified index |
WebDriver | SelectByValue | Selects a dropdown option element with the specified value attribute |
WebDriver | SelectByVisibleText | Selects a dropdown option element with the specified visible text |
WebDriver | SendKeys | Sends a key sequence to the specified element - see WebKeyboard class for how to send special keys and chords |
WebDriver | SendKeysToOS | Sends a key sequence to the active or specified OS window - see WebKeyboard class for how to send special keys and chords. This method can optionally run on a delayed separate thread to interact with inline execution-blocking windows |
WebDriver | SetAttribute | Sets the attribute of the element |
WebDriver | SetCookie | Sets a cookie object |
WebDriver | SetCookies | Sets a cookies collection object |
WebDriver | SetDownloadFolder | Sets the default download folder path - for Edge and Chrome browsers only |
WebDriver | SetFocus | Sets the focus to the specified element |
WebDriver | SetGeolocation | Sets geolocation parameter values |
WebDriver | SetHighlight | Highlights/unhighlights specified element(s) with color |
WebDriver | SetHightlightFoundElems | Highlights/unhighlights future found element(s) with color |
WebDriver | Shutdown | Shuts down all driver instances attached to this driver's port |
WebDriver | StartChrome | Start a Chrome driver |
WebDriver | StartEdge | Start an Edge driver |
WebDriver | StartFirefox | Start a Firefox driver |
WebDriver | Submit | Submits a form element. If element not specified, then clicks on the active form element |
WebDriver | SwitchToAlert | Waits for alert to show and then returns a WebAlert object for further handling |
WebDriver | SwitchToDefaultContent | Switches focus to the frame of the main document |
WebDriver | SwitchToFrame | Switches focus to the frame element |
WebDriver | SwitchToFrameByIndex | Switches focus to the frame indicated by the specified index |
WebDriver | SwitchToParentFrame | Switches focus to the active frame's parent |
WebDriver | TableToArray | Returns a 1-based array holding the text values from a table or tbody element |
WebDriver | UploadFile | Uploads the contents of a file to the element |
WebDriver | Wait | Pauses in-line execution for the specified number of milliseconds |
WebDriver | WaitForDownload | Waits until file is finished downloading |
WebDriver | WaitUntilDisplayed | Waits until element is displayed (interactable) |
WebDriver | WaitUntilNotDisplayed | Waits until element is not displayed (not interactable) |
WebDriver | WaitUntilNotPresent | Waits until an element is not present anymore |
WebDriver | Windows | Returns the WebWindows object for managing the collection of all open WebWindow objects |
This class is used to maintain Selenium driver/browser version alignment. For SeleniumVBA to function, the Selenium WebDriver must be installed on the local drive, and be version-compatible with the installed browser. With SeleniumVBA, the version alignment is handled automatically, in the background. When the user starts the SeleniumVBA WebDriver, if the Selenium driver does not exist, or is out-of-date, SeleniumVBA will detect this automatically and download the appropriate driver to a desired location (currently defaults to user's download folder but that is easily configurable). However, the user can also programmatically invoke driver updates via this WebDriverManager class, if desired or needed.
Class | Method/Property | Description |
---|---|---|
WebDriverManager | AlignChromeDriverWithBrowser | Checks if driver is installed, or if installed driver is compatibile with installed browser, and then installs an updated driver if needed |
WebDriverManager | AlignEdgeDriverWithBrowser | Checks if driver is installed, or if installed driver is compatibile with installed browser, and then installs an updated driver if needed |
WebDriverManager | AlignFirefoxDriverWithBrowser | Checks if driver is installed, or if installed driver is compatibile with installed browser, and then installs an updated driver if needed |
WebDriverManager | CheckCompatibilityLevel | Returns the compatibility level between a pair of version strings |
WebDriverManager | DefaultDriverFolder | Sets the default driver folder path |
WebDriverManager | DeleteChromeDriver | Deletes the Chrome Driver from the specified path |
WebDriverManager | DeleteEdgeDriver | Deletes the Edge Driver from the specified path |
WebDriverManager | DeleteFirefoxDriver | Deletes the Firefox Driver from the specified path |
WebDriverManager | DownloadAndInstallDriver | Downloads and installs the specified Driver version |
WebDriverManager | GetCompatibleDriverVersion | Returns the most recent compatible Driver version given the installed Browser version |
WebDriverManager | GetDownloadsFolderPath | Returns the folder path to the local Downloads folder |
WebDriverManager | GetInstalledBrowserVersion | Returns the installed Browser version |
WebDriverManager | GetInstalledDriverVersion | Returns the installed Driver version |
WebDriverManager | GetLatestDriverVersion | Returns the latest Driver version |
WebDriverManager | GetSeleniumBasicFolderPath | Returns the folder path to Florent Breheret's SeleniumBasic application in local AppData, assuming that it is installed |
WebDriverManager | GetUserTempFolderPath | Returns the folder path to the Temp folder in local AppData |
This class provides a mechanism to represent webpage HTML elements as objects and perform various actions on the related elements. Example usage:
Dim elem As New WebElement
...
Set elem = driver.FindElement (By.Name, "Jose")
elem.Click()
Class | Method/Property | Description |
---|---|---|
WebElement | Clear | Clears the text field of this element |
WebElement | Click | Clicks this element |
WebElement | DeSelectAll | Deselects all dropdown option elements |
WebElement | DeSelectByIndex | Deselects a dropdown option element with the specified index |
WebElement | DeSelectByValue | Deselects the dropdown option element having the specified value attribute |
WebElement | DeSelectByVisibleText | Deselects the dropdown option element having the specified visible text |
WebElement | DownloadResource | Downloads a resource (such as an image) contained in an element attribute to a file or folder path - if a folder is specified, then the file will inherit the name of the source |
WebElement | DragAndDrop | Drags and drops this element to the specified target element |
WebElement | FindElement | Finds the first element for a given selector and value |
WebElement | FindElementByClassName | Finds the first element by the specified class name value |
WebElement | FindElementByCssSelector | Finds the first element by the specified css selector value |
WebElement | FindElementByID | Finds the first element by the specified id value |
WebElement | FindElementByLinkText | Finds the first element by the specified link text value |
WebElement | FindElementByName | Finds the first element by the specified name value |
WebElement | FindElementByPartialLinkText | Finds the first element by the specified partial link text value |
WebElement | FindElementByTagName | Finds the first element by the specified tag name value |
WebElement | FindElementByXPath | Finds the first element by the specified xpath query value |
WebElement | FindElements | Finds all elements that satisfy the specified selector and value |
WebElement | FindElementsByClassName | Finds all elements that satisfy the specified class name value |
WebElement | FindElementsByCssSelector | Finds all elements that satisfy the specified css selector value |
WebElement | FindElementsByID | Finds all elements that satisfy the specified id value |
WebElement | FindElementsByLinkText | Finds all elements that satisfy the specified link text value |
WebElement | FindElementsByName | Finds all elements that satisfy the specified name value |
WebElement | FindElementsByPartialLinkText | Finds all elements that satisfy the specified partial link text value |
WebElement | FindElementsByTagName | Finds all elements that satisfy the specified tag name value |
WebElement | FindElementsByXPath | Finds all elements that satisfy the specified xpath query value |
WebElement | GetAllSelectedOptions | Returns all selected dropdown option elements |
WebElement | GetAriaLabel | Gets the Arial label of this element |
WebElement | GetAriaRole | Gets the Arial role of this element |
WebElement | GetAttribute | Gets the specified attribute of this element |
WebElement | GetChildElements | Returns the direct descendant child elements of this element |
WebElement | GetCSSProperty | Gets the specified CSS property of this element |
WebElement | GetElementId | Returns the Element Id string - useful for testing purposes |
WebElement | GetInnerHTML | Gets the inner HTML of this element |
WebElement | GetOuterHTML | Gets the outer HTML of this element |
WebElement | GetParentElement | Returns the parent of this element |
WebElement | GetProperty | Gets the property state of this element, such as the value of an input box - if the property does not exist, then it returns vbNullString |
WebElement | GetRect | Returns a dictionary containing x, y, width, height, left, top, right, and bottom of the element's rectangle |
WebElement | GetScrollHeight | Gets the height of this scrollable element's content |
WebElement | GetScrollWidth | Gets the width of of this scrollable element's content |
WebElement | GetSelectedOption | Returns the first selected dropdown option element |
WebElement | GetShadowRoot | Gets the shadow root hosted by this element |
WebElement | GetTagName | Gets the Tag name of this element |
WebElement | GetText | Gets the text of this element - set optional visibleOnly to False to return text whether hidden or not |
WebElement | HasAttribute | Returns a boolean indicating if this element has the specified attribute |
WebElement | HasFocus | Returns a boolean indicating if the element has the focus |
WebElement | HasProperty | Returns a boolean indicating if this element has the specified property |
WebElement | Highlight | Highlights with color this element |
WebElement | IsDisplayed | Returns a boolean indicating if this element is displayed |
WebElement | IsEnabled | Returns a boolean indicating if this element is enabled |
WebElement | IsMultiSelect | Returns a boolean indicating if this element is a multi-select dropdown |
WebElement | IsPresent | Returns a boolean indicating if the element is present. User can optionally set an implicit wait, and obtain a reference to the found element. |
WebElement | IsSelected | Returns a boolean indicating if this dropdown option element is selected |
WebElement | QuerySelector | Finds the first element by the specified css selector value |
WebElement | QuerySelectorAll | Finds all elements that satisfy the specified css selector value |
WebElement | SaveScreenshot | Saves a screenshot of this element |
WebElement | ScrollBy | Scrolls by an x-y offset in pixels relative to this scrollable element's content position |
WebElement | ScrollIntoView | Scrolls this element into the visible viewport |
WebElement | ScrollTo | Scrolls to an x-y position in pixels relative to this scrollable element's content origin |
WebElement | ScrollToBottom | Scrolls to the bottom of this scrollable element's content |
WebElement | ScrollToTop | Scrolls to the top of this scrollable element's content |
WebElement | SelectAll | Selects all multi-select dropdown option elements |
WebElement | SelectByIndex | Selects a dropdown option element with the specified index |
WebElement | SelectByValue | Selects a dropdown option element with the specified value attribute |
WebElement | SelectByVisibleText | Selects a dropdown option element with the specified visible text |
WebElement | SendKeys | Sends a key sequence to this element |
WebElement | SetAttribute | Sets the attribute of this element |
WebElement | SetFocus | Scrolls and set the focus to this element |
WebElement | Submit | Submits a form element |
WebElement | SwitchToFrame | Switches to this frame element |
WebElement | TableToArray | Returns a 1-based array holding the text values from a table or tbody element |
WebElement | UnHighlight | Unhighlights this element |
WebElement | UploadFile | Uploads the contents of a file to this element |
WebElement | WaitUntilDisplayed | Waits until this element is displayed (interactable) |
WebElement | WaitUntilNotDisplayed | Waits until this element is not displayed (not interactable) |
This class is used for managing a collection of WebElement objects.
Class | Method/Property | Description |
---|---|---|
WebElements | Add | Adds an element to the collection |
WebElements | Count | Returns the number of elements in the collection |
WebElements | Exists | Returns True if element object is already in the collection, False otherwise |
WebElements | Highlight | Highlights this element collection with color |
WebElements | Item | Returns the element corresponding to the given index |
WebElements | Remove | Removes an element corresponding to the given index or element object |
WebElements | RemoveAll | Removes all member element objects from the collection |
WebElements | Size | Returns the number of elements in the collection |
WebElements | UnHighlight | Unhighlights this element collection |
This class is used to automate keyboard actions. Use in conjunction with the WebDriver object's SendKeys method, and with the WebActionChain object's methods. This class is predeclared. Example usage:
Dim keys as New WebKeyboard
...
keySeq = "This is COOKL!" & keys.LeftKey & keys.LeftKey & keys.LeftKey & keys.DeleteKey & keys.ReturnKey
driver.FindElement(By.Name, "q").SendKeys keySeq
Class | Method/Property | Description |
---|---|---|
WebKeyboard | AddKey | Returns the Add (\uE025) key |
WebKeyboard | AltKey | Returns the Alt (\uE00a) key |
WebKeyboard | AltShiftKeys | Returns the AltShift (\uE00a + \uE008) keys |
WebKeyboard | BackspaceKey | Returns the Backspace (\uE003) key |
WebKeyboard | CancelKey | Returns the Cancel (\uE001) key |
WebKeyboard | Chord | Returns modifier key(s) down, keys to send, modifier key(s) up sequence |
WebKeyboard | ClearKey | Returns the Clear (\uE005) key |
WebKeyboard | CommandKey | Returns the Command (\uE03d) key |
WebKeyboard | CtrlAltKeys | Returns the CtrlAlt (\uE009 + \uE00a) keys |
WebKeyboard | CtrlKey | Returns the Ctrl (\uE009) key |
WebKeyboard | CtrlShiftKeys | Returns the CtrlShift (\uE009 + \uE008) keys |
WebKeyboard | DecimalKey | Returns the Decimal (\uE028) key |
WebKeyboard | DeleteKey | Returns the Delete (\uE017) key |
WebKeyboard | DivideKey | Returns the Divide (\uE029) key |
WebKeyboard | DownKey | Returns the Down (\uE015) key |
WebKeyboard | EndKey | Returns the End (\uE010) key |
WebKeyboard | EnterKey | Returns the Enter (\uE007) key |
WebKeyboard | EqualsKey | Returns the Equals (\uE019) key |
WebKeyboard | EscapeKey | Returns the Escape (\uE00c) key |
WebKeyboard | F10Key | Returns the F10 (\uE03a) key |
WebKeyboard | F11Key | Returns the F11 (\uE03b) key |
WebKeyboard | F12Key | Returns the F12 (\uE03c) key |
WebKeyboard | F1Key | Returns the F1 (\uE031) key |
WebKeyboard | F2Key | Returns the F2 (\uE032) key |
WebKeyboard | F3Key | Returns the F3 (\uE033) key |
WebKeyboard | F4Key | Returns the F4 (\uE034) key |
WebKeyboard | F5Key | Returns the F5 (\uE035) key |
WebKeyboard | F6Key | Returns the F6 (\uE036) key |
WebKeyboard | F7Key | Returns the F7 (\uE037) key |
WebKeyboard | F8Key | Returns the F8 (\uE038) key |
WebKeyboard | F9Key | Returns the F9 (\uE039) key |
WebKeyboard | HelpKey | Returns the Help (\uE002) key |
WebKeyboard | HomeKey | Returns the Home (\uE011) key |
WebKeyboard | InsertKey | Returns the Insert (\uE016) key |
WebKeyboard | LeftKey | Returns the Left (\uE012) key |
WebKeyboard | MetaKey | Returns the Meta (\uE03d) key |
WebKeyboard | MultiplyKey | Returns the Multiply (\uE024) key |
WebKeyboard | NullKey | Returns the Null (\uE000) key - triggers release of all previous modifiers used in the string |
WebKeyboard | Numpad0Key | Returns the Numpad 0 (\uE01a) key |
WebKeyboard | Numpad1Key | Returns the Numpad 1 (\uE01b) key |
WebKeyboard | Numpad2Key | Returns the Numpad 2 (\uE01c) key |
WebKeyboard | Numpad3Key | Returns the Numpad 3 (\uE01d) key |
WebKeyboard | Numpad4Key | Returns the Numpad 4 (\uE01e) key |
WebKeyboard | Numpad5Key | Returns the Numpad 5 (\uE01f) key |
WebKeyboard | Numpad6Key | Returns the Numpad 6 (\uE020) key |
WebKeyboard | Numpad7Key | Returns the Numpad 7 (\uE021) key |
WebKeyboard | Numpad8Key | Returns the Numpad 8 (\uE022) key |
WebKeyboard | Numpad9Key | Returns the Numpad 9 (\uE023) key |
WebKeyboard | PageDownKey | Returns the PageDown (\uE00f) key |
WebKeyboard | PageUpKey | Returns the PageUp (\uE00e) key |
WebKeyboard | PauseKey | Returns the Pause (\uE00b) key |
WebKeyboard | Repeat | Returns a string consisting of a sub-string repeated the specified number of times |
WebKeyboard | ReturnKey | Returns the Return (\uE006) key |
WebKeyboard | RightKey | Returns the Right (\uE014) key |
WebKeyboard | SemicolonKey | Returns the Semicolon (\uE018) key |
WebKeyboard | SeparatorKey | Returns the Separator (\uE026) key |
WebKeyboard | ShiftKey | Returns the Shift (\uE008) key |
WebKeyboard | SpaceKey | Returns the Space (\uE00d) key |
WebKeyboard | SubtractKey | Returns the Subtract (\uE027) key |
WebKeyboard | TabKey | Returns the Tab (\uE004) key |
WebKeyboard | UpKey | Returns the Up (\uE013) key |
WebKeyboard | ZenkakuHankakuKey | Returns the Zenkaku to Hankaku (\uE040) key for Japanese keyboard |
This class is used to manage print settings for generating pdf files using PrintToPDF method of the WebDriver class.
Class | Method/Property | Description |
---|---|---|
WebPrintSettings | Background | Sets or gets the background property |
WebPrintSettings | MarginBottom | Sets or gets the bottom margin |
WebPrintSettings | MarginLeft | Sets or gets the left margin |
WebPrintSettings | MarginRight | Sets or gets the right margin |
WebPrintSettings | MarginsAll | Sets all margins to same value |
WebPrintSettings | MarginTop | Sets or gets the top margin |
WebPrintSettings | Orientation | Sets or gets the page orientation |
WebPrintSettings | PageHeight | Sets or gets the page height |
WebPrintSettings | PageRanges | Sets a list of pages and page ranges to print |
WebPrintSettings | PageWidth | Sets or gets the page width |
WebPrintSettings | PrintScale | Sets or gets the print scale (fractional) |
WebPrintSettings | ShrinkToFit | Sets or gets the shrink-to-fit property |
WebPrintSettings | Units | Sets or gets the measurement units in centimeters or inches |
This class is used for exposing a shadow root DOM subtree that is rendered separately from a document's main DOM tree. Use the FindElement method to return the WebElement that hosts the target shadow root, and then use GetShadowRoot method to expose the shadow root's DOM subtree. Example usage:
Set element = driver.FindElement(By.ID, "shadow_host").GetShadowRoot.FindElement(By.ID, "shadow_content")
Class | Method/Property | Description |
---|---|---|
WebShadowRoot | FindElement | Finds the first element for a given selector and value |
WebShadowRoot | FindElements | Finds all elements that satisfy the specified selector and value |
This class is used to manage window properties. Can be instantiated using ActiveWindow of the WebDriver class, or through the WebWindows class.
Class | Method/Property | Description |
---|---|---|
WebWindow | Activate | Activates this window |
WebWindow | Bounds | Sets/Returns a dictionary object specifying the x, y, width, and height of this window in screen pixels |
WebWindow | CloseIt | Closes this window |
WebWindow | FullScreen | Sets this window to full screen mode |
WebWindow | Handle | Returns this window's internal handle string |
WebWindow | IsActive | Returns a boolean value indicating whether this window is the active window |
WebWindow | IsNotSameAs | Returns boolean indicating whether the specified window is not the same as this window |
WebWindow | IsSameAs | Returns boolean indicating whether the specified window is same as this window |
WebWindow | Maximize | Maximize this window |
WebWindow | Minimize | Minimize this window |
WebWindow | SetPosition | Sets the position for this window in screen pixels |
WebWindow | SetSize | Sets the size for this window in screen pixels |
WebWindow | SwitchTo | Activates this window |
WebWindow | Title | Gets this window's browser title |
WebWindow | Url | Gets this window's url |
This class is used to manage a collection of WebWindow objects. It must be instantiated using WebDriver's Windows method.
Class | Method/Property | Description |
---|---|---|
WebWindows | Active | Returns the active window object |
WebWindows | Count | Returns the number of windows in the collection |
WebWindows | Handles | Returns the collection of open window handles |
WebWindows | Item | Returns the window associated with the provided index or handle |
WebWindows | Refresh | Refreshes the windows collection with all currently open windows |
WebWindows | SwitchToByTitle | Activates and returns the first window found after the active window with the specified (partial) window title text |
WebWindows | SwitchToByUrl | Activates and returns the first window found after the active window with the specified (partial) window url text |
WebWindows | SwitchToNew | Opens, activates, and returns a new window of the specified type |
WebWindows | SwitchToNext | Activates and returns the first window found after the active one in the open windows collection |
WebWindows | Titles | Returns the collection of open window titles |
WebWindows | Urls | Returns the collection of open window urls |
Full Disclosure: Some of the above text was generated by ChatGPT and then modified to suit the needs of this Wiki page.