feat: throw err for non-element node type
This commit is contained in:
@@ -135,7 +135,11 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
|
|||||||
let rootDocument: Document | Element;
|
let rootDocument: Document | Element;
|
||||||
|
|
||||||
function finder(input: Element, options?: Partial<Options>) {
|
function finder(input: Element, options?: Partial<Options>) {
|
||||||
|
if (input.nodeType !== Node.ELEMENT_NODE) {
|
||||||
|
throw new Error(`Can't generate CSS selector for non-element node type.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const defaults: Options = {
|
const defaults: Options = {
|
||||||
root: document.body,
|
root: document.body,
|
||||||
idName: (name: string) => true,
|
idName: (name: string) => true,
|
||||||
|
|||||||
Reference in New Issue
Block a user