summaryrefslogtreecommitdiff
path: root/crocoite/data
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-05-01 10:37:08 +0200
committerLars-Dominik Braun <lars@6xq.net>2018-05-04 16:00:05 +0200
commiteb818f0c6eb86461a0db1845876f2a0b39b99b7f (patch)
tree2b25cb248e4a2aca0577a336f48ae112c7e54408 /crocoite/data
parentd8193765df85293f825abc486ac5cb1f5ac0a028 (diff)
downloadcrocoite-eb818f0c6eb86461a0db1845876f2a0b39b99b7f.tar.gz
crocoite-eb818f0c6eb86461a0db1845876f2a0b39b99b7f.tar.bz2
crocoite-eb818f0c6eb86461a0db1845876f2a0b39b99b7f.zip
behavior: Add link extraction script
Diffstat (limited to 'crocoite/data')
-rw-r--r--crocoite/data/extract-links.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/crocoite/data/extract-links.js b/crocoite/data/extract-links.js
new file mode 100644
index 0000000..f2a37aa
--- /dev/null
+++ b/crocoite/data/extract-links.js
@@ -0,0 +1,9 @@
+/* Extract links from a page
+ */
+let x = document.body.querySelectorAll('a[href]');
+let ret = [];
+let index = 0;
+for( index=0; index < x.length; index++ ) {
+ ret.push (x[index].href);
+}
+ret; /* immediately return results, for use with Runtime.evaluate() */