Skip to content

Instantly share code, notes, and snippets.

@andruhon
Created August 17, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andruhon/6d50b18214799e2b7bc5971a286bd045 to your computer and use it in GitHub Desktop.
Save andruhon/6d50b18214799e2b7bc5971a286bd045 to your computer and use it in GitHub Desktop.
LJ blog scaner for Selenium IDE or selenium-side-runner, replace YOUR with your journal LAST_SCANNED_POST with last post id. Finds all links and logs them
{
"id": "7908efff-abd8-45b6-9a03-536bd06294e9",
"version": "2.0",
"name": "ljscaner",
"url": "https://YOUR.livejournal.com",
"tests": [{
"id": "33fd5216-ee07-456a-a9b6-1dd23a464bbd",
"name": "scan lj",
"commands": [{
"id": "d1f835b7-ab7f-4b22-a4bb-ac32b2f655e3",
"comment": "",
"command": "open",
"target": "/LAST_SCANNED_POST.html",
"targets": [],
"value": ""
}, {
"id": "1ba619e4-c057-4102-937e-8e51b4b9c925",
"comment": "",
"command": "setWindowSize",
"target": "1920x1177",
"targets": [],
"value": ""
}, {
"id": "3599cf3e-1056-45e8-8ee8-e8898d1fec96",
"comment": "",
"command": "do",
"target": "",
"targets": [],
"value": ""
}, {
"id": "b14cff9f-b171-4d06-8e69-e08d71acd1c7",
"comment": "",
"command": "executeScript",
"target": "return Array.from(document.querySelectorAll('.aentry-post__content a, .entry-content a')).filter(a => a.href && !a.href.startsWith(\"https://YOUR.livejournal.com\")).map(a => a.href).length",
"targets": [],
"value": "linksPresent"
}, {
"id": "12165d88-1a6c-4876-a7c5-05cfa596d56f",
"comment": "",
"command": "if",
"target": "${linksPresent}>0",
"targets": [],
"value": ""
}, {
"id": "c615662f-6190-472f-96d5-1d9ecb363e26",
"comment": "",
"command": "executeScript",
"target": "return document.title",
"targets": [],
"value": "title"
}, {
"id": "12a3cf27-9f84-412e-b17f-1a165563dc7b",
"comment": "",
"command": "executeScript",
"target": "return document.location.href",
"targets": [],
"value": "location"
}, {
"id": "c0754ca5-e7d8-4bb0-8e37-ee1c2dde2a86",
"comment": "",
"command": "echo",
"target": "found on ${location} ${title}",
"targets": [],
"value": ""
}, {
"id": "b3cb5885-e491-4134-847a-b58ab7f2b6c5",
"comment": "",
"command": "executeScript",
"target": "return Array.from(document.querySelectorAll('.aentry-post__content a, .entry-content a')).filter(a => a.href && !a.href.startsWith(\"https://YOUR.livejournal.com\")).map(a => a.href).join(\" \")",
"targets": [],
"value": "links"
}, {
"id": "bd3db4e9-fdfe-423c-9512-7d7043ec178d",
"comment": "",
"command": "echo",
"target": "links: ${links}",
"targets": [],
"value": ""
}, {
"id": "8fa5e53a-0204-4184-830e-10f95ec59a30",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "a8f07b98-f3fe-4c32-9bce-280f13871dde",
"comment": "",
"command": "click",
"target": "xpath=//a[contains(text(),'Previous post')]|//img[@title='Previous Entry']/ancestor::a",
"targets": [],
"value": ""
}, {
"id": "285187bb-5760-43c0-8f64-59b46eb57fd2",
"comment": "",
"command": "storeXpathCount",
"target": "xpath=//a[contains(text(),'Previous post')]|//img[@title='Previous Entry']/ancestor::a",
"targets": [],
"value": "prevPostPresent"
}, {
"id": "e45d33ff-2871-42f4-820d-9d73fdd7f7a6",
"comment": "",
"command": "repeatIf",
"target": "${prevPostPresent}>0",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "e75e2f15-51cd-4bf2-a0ec-e9c7f816a226",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 500,
"tests": ["33fd5216-ee07-456a-a9b6-1dd23a464bbd"]
}],
"urls": ["https://YOUR.livejournal.com/"],
"plugins": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment