I was trying to extract information from an HTML table, I researched well in the wiki and other posts but I still can't make it work.
iMacros is "locked - frozen" in the first line TAG, try with variants of the code, with other cells and even with other web pages but it does not work.
I want to extract information from an HTML created by this forum, the code is here below and its respective link.
I tried many ways and read on several sides but still nothing of what I do works, everything is the same.
EDIT: My code... EDIT: SET !VAR1
Code: Select all
VERSION BUILD=1005 RECORDER=CR
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
SET !TIMEOUT_STEP 3
TAG POS=1 TYPE=TD ATTR=ID:cell_1-1 EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL
Code: Select all
<html>
<head>
<style>
.table
{
width: 100%
}
.row .cell
{
padding: 5px;
border: 1px solid black;
}
</style>
<script>
window.onload = function () {
var datasource = document.getElementById('datasource');
datasource.addEventListener('change', function (e) {
var csvFile = datasource.files[0];
var fileReader = new FileReader();
fileReader.onloadend = function (e) {
var table = document.getElementById('table');
var lines = fileReader.result.split(/\r?\n/);
var n = 0;
lines.forEach(function (line) {
n++;
var tr = document.createElement("tr");
tr.setAttribute("class", "row");
tr.setAttribute("id", "row_" + n);
var cells = line.split(/,/);
var m = 0;
cells.forEach(function (cell) {
var td = document.createElement("td");
m++;
td.setAttribute("id", "cell_" + n + "-" + m);
td.setAttribute("class", "cell");
var text = document.createTextNode(cell);
td.appendChild(text);
tr.appendChild(td);
});
table.appendChild(tr);
});
}
fileReader.readAsText(csvFile);
}, false);
}
</script>
</head>
<body>
Select CSV file:
<input type="file" id="datasource" />
<div>Table with loaded CSV file:</div>
<table id="table" class=table></table>
</body>
</html>
- Windows 10 x64
Chrome: v77
iMacros: 10.0.5 'Free'