I'm new to Selenium and trying to wrap my head around it. I'm trying some lines of JS in the Chrome console and if they work, execute them via executeScript.
I'm doing for example: document.swQuerySelectorAll("[fill]");
In Chrome, this will return the following:
E.g. an array of 4 paths.
Doing the same in Selenium:
async getWithFill(){
return this.driver.executeScript("return document.swQuerySelectorAll('[fill]')");
}
...
...
const withfill = await this.getWithFill();
console.log("withfill: " + JSON.stringify(leafletMarkerPaneChildren, getCircularReplacer()));
(getCircularReplacer as per here)
This, however, won't return a proper array of paths, but this mess:
[{"driver_":{"flow_":{"propagateUnhandledRejections_":true,"activeQueue_":null,"taskQueues_":{},"shutdownTask_":null,"hold_":{"_called":false,"_idleTimeout":2147483647,"_idlePrev":{"_unrefed":false,"msecs":2147483647,"_timer":{}},"_idleStart":40995,"_repeat":2147483647,"_destroyed":false}},"session_":{"stack_":null,"parent_":null,"callbacks_":null,"state_":"fulfilled","handled_":true,"value_":"e4e6a8fe5fda07f3f72c0cbf328ed68d","queue_":{"name_":"TaskQueue::14","tasks_":[],"interrupts_":null,"pending_":null,"subQ_":null,"state_":"finished","unhandledRejections_":{}}},"executor_":{"w3c":false,"customCommands_":{},"log_":{"name_":"webdriver.http.Executor","level_":null,"parent_":{"name_":"webdriver.http","level_":null,"parent_":{"name_":"webdriver","level_":null,"parent_":{"name_":"","level_":{"name_":"OFF","value_":null},"parent_":null,"handlers_":null},"handlers_":null},"handlers_":null},"handlers_":null}},"fileDetector_":null},"id_":{"stack_":null,"parent_":null,"callbacks_":null,"state_":"fulfilled","handled_":false,"value_":"0.5320635799241777-7","queue_":{"name_":"TaskQueue::1680","tasks_":[],"interrupts_":null,"pending_":null,"subQ_":null,"state_":"finished","unhandledRejections_":{}}}},{"id_":{"stack_":null,"parent_":null,"callbacks_":null,"state_":"fulfilled","handled_":false,"value_":"0.5320635799241777-8"}}]
What even is this and how do I get my array as expected based on the Chrome console output?

Aucun commentaire:
Enregistrer un commentaire