Skip to content

Instantly share code, notes, and snippets.

@pleabargain
Last active October 13, 2018 08:14
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 pleabargain/836de3d69d2130f73385de02ca0bcdae to your computer and use it in GitHub Desktop.
Save pleabargain/836de3d69d2130f73385de02ca0bcdae to your computer and use it in GitHub Desktop.
Kantu macro extracting data and saving as CSV
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>testCSVsave</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">testCSVsave</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>https://www.xe.com/ibancalculator/countrylist/</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//*[@id="country-list"]/li[${!loop}]/a/img</td>
<td></td>
</tr>
<tr>
<td>storeText</td>
<td>//*[@id="contentL"]/div[1]/table/tbody/tr[1]/th[2]</td>
<td> !csvLine</td>
</tr>
<tr>
<td>csvSave</td>
<td>newtesttestIBAN</td>
<td></td>
</tr>
</tbody></table>
<script>
(function() {
try {
var evt = new CustomEvent('kantuSaveAndRunMacro', { detail: { html: document.documentElement.outerHTML } })
window.dispatchEvent(evt);
if (window.location.protocol === 'file:') {
var onInvokeSuccess = function () {
clearTimeout(timer)
window.removeEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
var timer = setTimeout(function () {
alert("Error: It seems you need to enable File Access for Kantu in the extension settings.")
}, 2000)
window.addEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
} catch (e) {
alert('Kantu Bookmarklet error: ' + e.toString());
}
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment