Selenium automates browsers. That's it!
What you do with that power is entirely up to you.
Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that.
Boring web-based administration tasks can (and should) also be automated as well.
Wrapper is based on Selenium Java v4.27.0 (November 25, 2024) from HERE.
Versions:
v0.70
v0.80
v0.81
v0.85
v0.90
Examples:
Selenium1.zip
Selenium2.zip
Download library from: https://www.dropbox.com/scl/fi/yqdu...ey=91dfe0o19u45xqsebd2j26yth&st=jheflmt1&dl=0
When you download Chrome For Testing as well as the Chrome Driver, make sure to extract everything into one folder.
chrome.exe and chromedriver.exe should be in same folder.
For Windows use:
Chrome For Testing: https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/win64/chrome-win64.zip
Chrome Driver: https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/win64/chromedriver-win64.zip
If you are using other OS download Chrome For Testing and Chrome Driver from: https://googlechromelabs.github.io/chrome-for-testing/
Latest library version is tested with Chrome For Testing and Chrome Driver v131.0.6778.204
What you do with that power is entirely up to you.
Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that.
Boring web-based administration tasks can (and should) also be automated as well.
Wrapper is based on Selenium Java v4.27.0 (November 25, 2024) from HERE.
Pnd_Selenium
Author: Author: selenium.dev - B4j Wrapper: Pendrush
Version: 0.90
- Pnd_Cookies
- Fields:
- Domain As String
The domain the cookie is visible to- Expires As java.util.Date
The cookie's expiration date- IsHttpOnly As Boolean
Whether this cookie is a httpOnly cookie- IsSecure As Boolean
Whether this cookie requires a secure connection- Name As String
The name of the cookie- Path As String
The path the cookie is visible to.- SameSite As String
The samesite attribute of this cookie; None, Lax, Strict- Value As String
The cookie value- Pnd_KeyCodes
- Functions:
- ADD As org.openqa.selenium.Keys
- ALT As org.openqa.selenium.Keys
- ARROW_DOWN As org.openqa.selenium.Keys
- ARROW_LEFT As org.openqa.selenium.Keys
- ARROW_RIGHT As org.openqa.selenium.Keys
- ARROW_UP As org.openqa.selenium.Keys
- BACK_SPACE As org.openqa.selenium.Keys
- CANCEL As org.openqa.selenium.Keys
- CLEAR As org.openqa.selenium.Keys
- COMMAND As org.openqa.selenium.Keys
- CONTROL As org.openqa.selenium.Keys
- DECIMAL As org.openqa.selenium.Keys
- DELETE As org.openqa.selenium.Keys
- DIVIDE As org.openqa.selenium.Keys
- DOWN As org.openqa.selenium.Keys
- END As org.openqa.selenium.Keys
- ENTER As org.openqa.selenium.Keys
- EQUALS As org.openqa.selenium.Keys
- ESCAPE As org.openqa.selenium.Keys
- F1 As org.openqa.selenium.Keys
- F10 As org.openqa.selenium.Keys
- F11 As org.openqa.selenium.Keys
- F12 As org.openqa.selenium.Keys
- F2 As org.openqa.selenium.Keys
- F3 As org.openqa.selenium.Keys
- F4 As org.openqa.selenium.Keys
- F5 As org.openqa.selenium.Keys
- F6 As org.openqa.selenium.Keys
- F7 As org.openqa.selenium.Keys
- F8 As org.openqa.selenium.Keys
- F9 As org.openqa.selenium.Keys
- HELP As org.openqa.selenium.Keys
- HOME As org.openqa.selenium.Keys
- INSERT As org.openqa.selenium.Keys
- LEFT As org.openqa.selenium.Keys
- LEFT_ALT As org.openqa.selenium.Keys
- LEFT_CONTROL As org.openqa.selenium.Keys
- LEFT_SHIFT As org.openqa.selenium.Keys
- META As org.openqa.selenium.Keys
- MULTIPLY As org.openqa.selenium.Keys
- NULL As org.openqa.selenium.Keys
- NUMPAD0 As org.openqa.selenium.Keys
- NUMPAD1 As org.openqa.selenium.Keys
- NUMPAD2 As org.openqa.selenium.Keys
- NUMPAD3 As org.openqa.selenium.Keys
- NUMPAD4 As org.openqa.selenium.Keys
- NUMPAD5 As org.openqa.selenium.Keys
- NUMPAD6 As org.openqa.selenium.Keys
- NUMPAD7 As org.openqa.selenium.Keys
- NUMPAD8 As org.openqa.selenium.Keys
- NUMPAD9 As org.openqa.selenium.Keys
- PAGE_DOWN As org.openqa.selenium.Keys
- PAGE_UP As org.openqa.selenium.Keys
- PAUSE As org.openqa.selenium.Keys
- RETURN As org.openqa.selenium.Keys
- RIGHT As org.openqa.selenium.Keys
- SEMICOLON As org.openqa.selenium.Keys
- SEPARATOR As org.openqa.selenium.Keys
- SPACE As org.openqa.selenium.Keys
- SUBTRACT As org.openqa.selenium.Keys
- TAB As org.openqa.selenium.Keys
- UP As org.openqa.selenium.Keys
- ZENKAKU_HANKAKU As org.openqa.selenium.Keys
- Pnd_LogLevel
- Functions:
- ALL As java.util.logging.Level
ALL indicates that all messages should be logged.- CONFIG As java.util.logging.Level
CONFIG is a message level for static configuration messages.
CONFIG messages are intended to provide a variety of static configuration information, to assist in debugging problems that may be associated with particular configurations.
For example, CONFIG message might include the CPU type, the graphics depth, the GUI look-and-feel, etc.- FINE As java.util.logging.Level
FINE is a message level providing tracing information.
All of FINE, FINER, and FINEST are intended for relatively detailed tracing. The exact meaning of the three levels will vary between subsystems, but in general, FINEST should be used for the most voluminous detailed output, FINER for somewhat less detailed output, and FINE for the lowest volume (and most important) messages.
In general the FINE level should be used for information that will be broadly interesting to developers who do not have a specialized interest in the specific subsystem.
FINE messages might include things like minor (recoverable) failures. Issues indicating potential performance problems are also worth logging as FINE.- FINER As java.util.logging.Level
FINER indicates a fairly detailed tracing message. By default logging calls for entering, returning, or throwing an exception are traced at this level.- FINEST As java.util.logging.Level
FINEST indicates a highly detailed tracing message- INFO As java.util.logging.Level
INFO is a message level for informational messages.
Typically INFO messages will be written to the console or its equivalent.
So the INFO level should only be used for reasonably significant messages that will make sense to end users and system administrators.- OFF As java.util.logging.Level
OFF is a special level that can be used to turn off logging.- SEVERE As java.util.logging.Level
SEVERE is a message level indicating a serious failure.
In general SEVERE messages should describe events that are of considerable importance and which will prevent normal program execution.
They should be reasonably intelligible to end users and to system administrators.- WARNING As java.util.logging.Level
WARNING is a message level indicating a potential problem.
In general WARNING messages should describe events that will be of interest to end users or system managers, or which indicate potential problems.- Pnd_Selenium
- Events:
- GetFinished
- Functions:
- AddArgument (Argument As String)
Argument – The arguments to use when starting Chrome
List of possible Arguments.
Another ist of possible Arguments.
Selenium.AddArgument("--start-maximized")- AddCookie (Name As String, Value As String, Domain As String, Path As String, Expires As Long, IsSecure As Boolean, IsHttpOnly As Boolean, SameSite As String)
Add a specific cookie. If the cookie's domain name is left blank, it is assumed that the cookie is meant for the domain of the current document.
See W3C WebDriver specification for more details.
Name – The name of the cookie; may not be an empty string.
Value – The cookie value.
Domain – The domain the cookie is visible to.
Path – The path the cookie is visible to. If left blank, will be set to "/".
Expires – The cookie's expiration date.
IsSecure – Whether this cookie requires a secure connection.
IsHttpOnly – Whether this cookie is a httpOnly cookie.
SameSite – The samesite attribute of this cookie; None, Lax, Strict.- AlertAccept
Press the OK button in alert dialog.
Alert is not initialized anymore after execution of AlertAccept, you need to execute AlertSwitchTo to initialize alert again.- AlertDismiss
Press the Cancel button in alert dialog.
Alert is not initialized anymore after execution of AlertDismiss, you need to execute AlertSwitchTo to initialize alert again.- AlertGetText As String
Get alert text- AlertSendKeys (KeysToSend As String)
Use this method to simulate typing into input filed in alert dialog.
KeysToSend - string to send to the Alert.- AlertSwitchTo As Boolean
AlertSwitchTo switches to the currently active modal dialog and initilize usage of other Alert properties
Returns: True if switch is successful, False if the dialog cannot be found.
Dim SwitchSuccess As Boolean
SwitchSuccess = Selenium.AlertSwitchTo
If SwitchSuccess Then
Dim AlertText As String = Selenium.AlertGetText
Log (AlertText)
Selenium.AlertAccept
End If- AllTabs As List
Returns: string List of all tabs- Close
Close the current window, quitting the browser if it's the last window currently open.
See W3C WebDriver specification for more details.- CurrentUrl As String
Get a string representing the current URL that the browser is looking at.
See W3C WebDriver specification for more details.
Returns: The URL of the page currently loaded in the browser- DeleteAllCookies
Delete all the cookies for the current domain.
See W3C WebDriver specification for more details.- DeleteCookieNamed (Name As String)
Delete the named cookie from the current domain. This is equivalent to setting the named cookie's expiry date to some time in the past.
Name – the name of the cookie
See W3C WebDriver specification for more details.- ExecuteAsyncScript (JsScript As String, WebElement As org.openqa.selenium.WebElement) As String
Execute an asynchronous piece of JavaScript in the context of the currently selected frame or window.
Unlike executing synchronous JavaScript, scripts executed with this method must explicitly signal they are finished by invoking the provided callback.
This callback is always injected into the executed function as the last argument.
The first argument passed to the callback function will be used as the script's result. This value will be CONVERTED to String.
The default timeout for a script to be executed is 0ms.
In most cases you must set the script timeout, use ScriptTimeout(millis) beforehand to a value sufficiently large enough.
See StackOverflow for questions and examples.- ExecuteScript (JsScript As String, WebElement As org.openqa.selenium.WebElement) As String
Executes JavaScript in the context of the currently selected frame or window. The script fragment provided will be executed as the body of an anonymous function.
Within the script, use document to refer to the current document. Note that local variables will not be available once the script has finished executing, though global variables will persist.
If the script has a return value (i.e. if the script contains a return statement), then the return value will be CONVERTED to String.- FindByClassName (WebElement As Object, ClassName As String) As org.openqa.selenium.WebElement
Find element within the current page using Class Name.
WebElement - Pass WebElement object or pass "" if you don't use it.
Returns: Object of WebElement- FindByClassNameList (WebElement As Object, ClassName As String) As List
Find all elements within the current page using Class Name.
WebElement - Pass WebElement object or pass "" if you don't use it.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
This method is affected by the 'implicit wait' times in force at the time of execution.
When implicitly waiting, this method will return as soon as there are more than 0 items in the found collection, or will return an empty list if the timeout is reached.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindByCssSelector (WebElement As Object, CssSelector As String) As org.openqa.selenium.WebElement
Find elements via the driver's underlying W3C Selector engine.
If the browser does not implement the Selector API, a best effort is made to emulate the API.
In this case, we strive for at least CSS2 support, but offer no guarantees.
WebElement - Pass WebElement object or pass "" if you don't use it.
CssSelector – CSS expression.
Returns: Object of WebElement- FindByCssSelectorList (WebElement As Object, CssSelector As String) As List
Find elements via the driver's underlying W3C Selector engine.
If the browser does not implement the Selector API, a best effort is made to emulate the API.
In this case, we strive for at least CSS2 support, but offer no guarantees.
WebElement - Pass WebElement object or pass "" if you don't use it.
CssSelector – CSS expression.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindById (WebElement As Object, Id As String) As org.openqa.selenium.WebElement
Find element within the current page using ID.
WebElement - Pass WebElement object or pass "" if you don't use it.
Returns: Object of WebElement- FindByIdList (WebElement As Object, Id As String) As List
Find all elements within the current page using ID.
WebElement - Pass WebElement object or pass "" if you don't use it.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
This method is affected by the 'implicit wait' times in force at the time of execution.
When implicitly waiting, this method will return as soon as there are more than 0 items in the found collection, or will return an empty list if the timeout is reached.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindByLinkText (WebElement As Object, LinkText As String) As org.openqa.selenium.WebElement
FindByLinkText works on the link text as you see it with your eyes on the website (after all CSS is applied), not by the website source code.
WebElement - Pass WebElement object or pass "" if you don't use it.- FindByLinkTextList (WebElement As Object, LinkText As String) As List
FindByLinkText works on the link text as you see it with your eyes on the website (after all CSS is applied), not by the website source code.
WebElement - Pass WebElement object or pass "" if you don't use it.
LinkText – The exact text to match against.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindByPartialLinkText (WebElement As Object, PartialLinkText As String) As org.openqa.selenium.WebElement
FindByPartialLinkText works on the link text as you see it with your eyes on the website (after all CSS is applied), not by the website source code.
WebElement - Pass WebElement object or pass "" if you don't use it.
PartialLinkText – The partial text to match against.
Returns: Object of WebElement- FindByPartialLinkTextList (WebElement As Object, PartialLinkText As String) As List
FindByPartialLinkText works on the link text as you see it with your eyes on the website (after all CSS is applied), not by the website source code.
WebElement - Pass WebElement object or pass "" if you don't use it.
PartialLinkText – The partial text to match against.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindByTagName (WebElement As Object, TagName As String) As org.openqa.selenium.WebElement
WebElement - Pass WebElement object or pass "" if you don't use it.
TagName – The element's tag name.
Returns: Object of WebElement- FindByTagNameList (WebElement As Object, TagName As String) As List
WebElement - Pass WebElement object or pass "" if you don't use it.
TagName – The element's tag name.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- FindByXpath (WebElement As Object, Path As String) As org.openqa.selenium.WebElement
WebElement - Pass WebElement object or pass "" if you don't use it.
Path – The XPath to use.
Returns: Object of WebElement- FindByXPathList (WebElement As Object, Path As String) As List
WebElement - Pass WebElement object or pass "" if you don't use it.
Path – The XPath to use.
Get the value of the given attribute of the element. Will return the current value, even if this has been modified after the page has been loaded.
More exactly, this method will return the value of the property with the given name, if it exists.
If it does not, then the value of the attribute with the given name is returned. If neither exists, null is returned.
The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked,
defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable,
ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate,
readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate.
Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected:
If the given name is "class", the "className" property is returned.
If the given name is "readonly", the "readOnly" property is returned.
Note: The reason for this behavior is that users frequently confuse attributes and properties.
See W3C WebDriver specification for more details.
Returns: List of WebElement As Object- Get (Url As String)
Load a new web page in the current browser window.
This is done using an HTTP POST operation, and the method will block until the load is complete with the default 'page load strategy'.
This will follow redirects issued either by the server or as a meta-redirect from within the returned HTML.
Should a meta-redirect "rest" for any duration of time, it is best to wait until this timeout is over,
since should the underlying page change whilst your test is executing the results of future calls against this interface will be against the freshly loaded page.
See W3C WebDriver specification for more details.- GetAllCookies As List
Get all the cookies for the current domain.
See W3C WebDriver specification for more details.
Returns: A list of cookies for the current domain.- GetCookieNamed (Name As String) As Pnd_Cookies
Get a cookie with a given name.
Name – the name of the cookie
See W3C WebDriver specification for more details.
Returns: the cookie, or empty cookies if no cookie with the given name is present- Initialize (EventName As String, ChromeDriverPath As String)
ChromeDriverPath - Path to Chrome driver
Selenium.Initialize("Selenium", "c:\ChromeDriver\chromedriver.exe")- PageSource As String
Get the source of the last loaded page.
If the page has been modified after loading (for example, by Javascript)
there is no guarantee that the returned text is that of the modified page.
Please consult the documentation of the particular driver being used to determine whether the returned text
reflects the current state of the page or the text last sent by the web server.
The page source returned is a representation of the underlying DOM: do not expect it to be formatted or escaped
in the same way as the response sent from the web server. Think of it as an artist's impression.
See W3C WebDriver specification for more details.
Returns: The source of the current page.- Quit
Quits, closing every associated window.- SwitchToDefaultContent
Selects either the first frame on the page, or the main document when a page contains iframes.
See W3C WebDriver specification for more details.
This driver focused on the top window / first frame.- SwitchToFrame (NameOrID As String)
Select a frame by its Name or ID. Frames located by matching name attributes are always given precedence over those matched by ID.
Params: NameOrID – the name of the frame window, the id of the < frame> or < iframe> element, or the (zero-based) index.- SwitchToParentFrame
Change focus to the parent context. If the current context is the top level browsing context, the context remains unchanged.
See W3C WebDriver specification for more details.
This driver focused on the parent frame.- SwitchToTab (Name As String)
Switch the focus of future commands for this driver to the window/tab with the given name.- TakeScreenshotToFile (Format As String, Path As String)
Capture the screenshot (only visible part of the page) and store it in the specified location.
Format - "png" or "jpg"
Path - "c:\test.jpg"
Selenium.TakeScreenshotToFile("jpg", "c:\test.jpg")- Title As String
Get the title of the current page.
See W3C WebDriver specification for more details.
Returns: The title of the current page, with leading and trailing whitespace stripped, or null if one is not already set- WebElementClear (WebElement As org.openqa.selenium.WebElement)
If this element is a form entry element, this will reset its value.
See W3C WebDriver specification for more details.- WebElementClick (WebElement As org.openqa.selenium.WebElement)
Click this element. If this causes a new page to load, you should discard all references to this element
and any further operations performed on this element will throw a StaleElementReferenceException.
Note that if click() is done by sending a native event (which is the default on most browsers/platforms)
then the method will _not_ wait for the next page to load and the caller should verify that themselves.
There are some preconditions for an element to be clicked.
The element must be visible, and it must have a height and width greater than 0.
See W3C WebDriver specification for more details.- WebElementGetAccessibleName (WebElement As org.openqa.selenium.WebElement) As String
Getsa result of a Accessible Name and Description Computation for the Accessible Name of the element.
See W3C WebDriver specification for more details.
Returns: The accessible name of the element.- WebElementGetAriaRole (WebElement As org.openqa.selenium.WebElement) As String
Gets result of computing the WAI-ARIA role of element.
See W3C WebDriver specification for more details.
Returns: The WAI-ARIA role of the element.- WebElementGetCssValue (WebElement As org.openqa.selenium.WebElement, PropertyName As String) As String
Get the value of a given CSS property. Color values could be returned as rgba or rgb strings. This depends on whether the browser omits the implicit opacity value or not.
For example if the "background-color" property is set as "green" in the HTML source, the returned value could be "rgba(0, 255, 0, 1)" if implicit opacity value is preserved or "rgb(0, 255, 0)" if it is omitted.
Note that shorthand CSS properties (e. g. background, font, border, border-top, margin, margin-top, padding, padding-top, list-style, outline, pause, cue) are not returned, in accordance with the DOM CSS2 specification - you should directly access the longhand properties (e. g. background-color) to access the desired values.
See W3C WebDriver specification for more details.
PropertyName – the css property name of the element- WebElementGetDomAttribute (WebElement As org.openqa.selenium.WebElement, Name As String) As String
Get the value of the given attribute of the element.
This method, unlike getAttribute(String), returns the value of the attribute with the given name but not the property with the same name.
The following are deemed to be "boolean" attributes, and will return either "true" or null:
async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, truespeed, willvalidate
See W3C WebDriver specification for more details.
Name – The name of the property- WebElementGetDomProperty (WebElement As org.openqa.selenium.WebElement, Name As String) As String
Get the value of the given property of the element. Will return the current value, even if this has been modified after the page has been loaded.
See W3C WebDriver specification for more details.
Name – The name of the property- WebElementGetRect (WebElement As org.openqa.selenium.WebElement) As String
Returns: The location and size of the rendered element. (X, Y, Height, Width)
See W3C WebDriver specification for more details.
X = X axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS pixels.
Y = Y axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS pixels.
Height = Height of the web element’s bounding rectangle in CSS pixels.
Width = Width of the web element’s bounding rectangle in CSS pixels.- WebElementGetTagName (WebElement As org.openqa.selenium.WebElement) As String
Get the tag name of this element. Not the value of the name attribute: will return "input" for the element .
See W3C WebDriver specification for more details.
Returns: The tag name of this element.- WebElementGetText (WebElement As org.openqa.selenium.WebElement) As String
Get the visible (i.e. not hidden by CSS) text of this element, including sub-elements.
See W3C WebDriver specification for more details.
Returns: The visible text of this element.- WebElementIsDisplayed (WebElement As org.openqa.selenium.WebElement) As Boolean
Is this element displayed or not? This method avoids the problem of having to parse an element's "style" attribute.- WebElementIsEnabled (WebElement As org.openqa.selenium.WebElement) As Boolean
Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
See W3C WebDriver specification for more details.- WebElementIsSelected (WebElement As org.openqa.selenium.WebElement) As Boolean
Determine whether this element is selected or not. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.
For more information on which elements this method supports, refer to the specification<.
See W3C WebDriver specification for more details.- WebElementSendKeys (WebElement As org.openqa.selenium.WebElement, Keys As String)
Use this method to simulate typing into an element, which may set its value.
See W3C WebDriver specification for more details.
Params: Keys – character sequence to send to the element- WebElementSubmit (WebElement As org.openqa.selenium.WebElement)
If this current element is a form, or an element within a form, then this will be submitted to the remote server.
If this causes the current page to change, then this method will block until the new page is loaded.- Properties:
- ImplicitlyWait As Long [write only]
Specifies the amount of milliseconds the driver should wait when searching for an element if it is not immediately present.
When searching for a single element, the driver should poll the page until the element has been found, or this timeout expires before throwing a NoSuchElementException.
When searching for multiple elements, the driver should poll the page until at least one element has been found or this timeout has expired.
Increasing the implicit wait timeout should be used judiciously as it will have an adverse effect on test run time, especially when used with slower location strategies like XPath.
If the timeout is negative or greater than 2e16 - 1, an error code with invalid argument will be returned.- LogLevel As java.util.logging.Level [write only]
Set the log level specifying which message levels will be logged by this logger.
Message levels lower than this value will be discarded.
OFF can be used to turn off logging.
Use Pnd_LogLevel class to set level- PageLoadTimeout As Long [write only]
Sets the amount of milliseconds to wait for a page load to complete before throwing an error.
If the timeout is negative or greater than 2e16 - 1, an error code with invalid argument will be returned.- ScriptTimeout As Long [write only]
Sets the amount of milliseconds to wait for an asynchronous script to finish execution before throwing an error.
If the timeout is negative or greater than 2e16 - 1, an error code with invalid argument will be returned.
Versions:
v0.70
- Removed ActionSendNonTextKey, as it not needed anymore
- Now you can send multiple special keys at once, for example CTRL+A (select all)
- Selenium is no longer connected to the version of Chrome browser installed on your computer
- New KeyCodes class for special keys
- New example app
- Selenium upgrade to v4.27.0
v0.80
- New Cookies class
- New example app
v0.81
- New functions like: WebElementIsSelected, WebElementIsDisplayed, etc. for direct interaction with WebElement objects
- Support for Alerts - modal dialogs
- Better documentation
- New example app
v0.85
- Return List As Objects of WebElement, to be able to interact with WebElement inside List
- New option: ExecuteAsyncScript
- New timeout options: ImplicitlyWait, PageLoadTimeout and ScriptTimeout for ExecuteAsyncScript
- ExecuteAsyncScript and ExecuteScript (synchronous) return String as value if return or callback statement exists
- New example app
v0.90
- New class LogLevel
- Removed one old class
- Now is possible to use nested WebElements
- Every FindBy function as first argument can use WebElement object
- New example apps
Examples:
Selenium1.zip
- How to setup Chrome for Testing and Chrome Driver
- Where to find and how to setup Argument for Chrome
- Cookies: get, get all, add, edit, delete, delete all
- ExecuteScript, ExecuteAsyncScript
- Fill form and submit form
- General library usage examples
Selenium2.zip
- How to get all links from the page with FindByTagNameList
- How to get all links from the page with FindByXPathList
- How to filter links
- How to get all TD text from all TABLES from all pages
- How to navigate from page to page without revisiting already visited links
Download library from: https://www.dropbox.com/scl/fi/yqdu...ey=91dfe0o19u45xqsebd2j26yth&st=jheflmt1&dl=0
When you download Chrome For Testing as well as the Chrome Driver, make sure to extract everything into one folder.
chrome.exe and chromedriver.exe should be in same folder.
For Windows use:
Chrome For Testing: https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/win64/chrome-win64.zip
Chrome Driver: https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.204/win64/chromedriver-win64.zip
If you are using other OS download Chrome For Testing and Chrome Driver from: https://googlechromelabs.github.io/chrome-for-testing/
Latest library version is tested with Chrome For Testing and Chrome Driver v131.0.6778.204
Attachments
Last edited: