Extracts WebElements based on different criteria. The input can either be a WebDriver (representing a browser’s window), or a WebElement (a subpart of the window). The following search criteria are available:
|Class Name||Finds elements based on their
|CSS Selector||Finds elements based on a CSS selector expression.|
|ID||Finds an element based in its
|Link Text||Finds links through an exact match of their text.|
|Name||Finds elements based on their
|Partial Link Text||Finds links by a partial match of the given text.|
|Tag Name||Finds elements based on their tag names.|
|XPath||Finds elements based on an XPath expression. (see e.g. here for a introduction to XPath)|
You can use the “Outline” view to easily create selector queries from the current DOM tree: Find the element you want to extract and double click on the corresponding line. A matching selector expression will be automatically inserted into the “Query” field.
Alternatively, you can select elements directly in the browser (works for Chromium-based browsers Chrome, Chromium): Click the “Select” button beside the “Query” input, switch to your browser window, and select any element on the page. A selector expression will be inserted into the “Query” field.
Please note that these feature require (1) a running browser instance which must show the actual data you want to extract, (2) the “full input data” to the node to be available.
To search for a text snippet within the DOM tree, use the search bar below the source.
For each extracted WebElement a new row is added to the output table.
Note that you cannot only search within the given input, but also navigate the entire DOM tree.
For example, you can use the XPath query
.. to find a WebElement’s parent.
Also note that you can only find on a DOM element level here, but not text content or attributes. To extract text, use this node to select the surrounding element, and then connect an “Extract InnerHTML” node to get the text. To extract attribute values, use an “Extract Attribute” node accordingly.
You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.
To use this node in KNIME, install the extension Selenium Nodes for KNIME from the below update site following our NodePit Product and Node Installation Guide:
A zipped version of the software site can be downloaded here.
Do you have feedback, questions, comments about NodePit, want to support this platform, or want your own nodes or workflows listed here as well? Do you think, the search results could be improved or something is missing? Then please get in touch! Alternatively, you can send us an email to firstname.lastname@example.org, follow @NodePit on Twitter, or chat on Gitter!
Please note that this is only about NodePit. We do not provide general support for KNIME — please use the KNIME forums instead.