automation_model 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/locator.js +4 -1
- package/bin/stable_browser.js +18 -7
- package/package.json +1 -1
package/bin/locator.js
CHANGED
|
@@ -57,7 +57,7 @@ function processTableQuary(table, quary) {
|
|
|
57
57
|
return { error: "Invalid quary" };
|
|
58
58
|
}
|
|
59
59
|
const rowSelector = match[1];
|
|
60
|
-
|
|
60
|
+
let columnSelector = match[2];
|
|
61
61
|
const property = match[3];
|
|
62
62
|
let selectedRows = [];
|
|
63
63
|
if (rowSelector === "*") {
|
|
@@ -77,7 +77,10 @@ function processTableQuary(table, quary) {
|
|
|
77
77
|
if (isNaN(columnSelector)) {
|
|
78
78
|
if (columnSelector.startsWith('"') && columnSelector.endsWith('"')) {
|
|
79
79
|
columnSelector = columnSelector.substring(1, columnSelector.length - 1);
|
|
80
|
+
} else if (columnSelector.startsWith("'") && columnSelector.endsWith("'")) {
|
|
81
|
+
columnSelector = columnSelector.substring(1, columnSelector.length - 1);
|
|
80
82
|
}
|
|
83
|
+
|
|
81
84
|
if (columnheader.length === 0) {
|
|
82
85
|
return { error: "No column header available" };
|
|
83
86
|
}
|
package/bin/stable_browser.js
CHANGED
|
@@ -270,18 +270,20 @@ class StableBrowser {
|
|
|
270
270
|
throw e;
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
async analyzeTable(selector,
|
|
273
|
+
async analyzeTable(selector, query, operator, value, _params = null, options = {}) {
|
|
274
274
|
const info = {};
|
|
275
275
|
info.log = [];
|
|
276
276
|
info.operation = "analyzeTable";
|
|
277
277
|
info.selector = selector;
|
|
278
|
-
info.
|
|
278
|
+
info.query = query;
|
|
279
|
+
query = this._fixUsingParams(query, _params);
|
|
280
|
+
info.query_fixed = query;
|
|
279
281
|
info.operator = operator;
|
|
280
282
|
info.value = value;
|
|
281
283
|
try {
|
|
282
284
|
let table = await this._locate(selector, info, _params);
|
|
283
285
|
await this._screenShot(options);
|
|
284
|
-
const cells = await getTableCells(this.page, table,
|
|
286
|
+
const cells = await getTableCells(this.page, table, query, info);
|
|
285
287
|
|
|
286
288
|
if (cells.error) {
|
|
287
289
|
throw new Error(cells.error);
|
|
@@ -308,8 +310,11 @@ class StableBrowser {
|
|
|
308
310
|
if (cells.length === 0) {
|
|
309
311
|
throw new Error("no cells found");
|
|
310
312
|
}
|
|
313
|
+
value = Number(value);
|
|
311
314
|
for (let i = 0; i < cells.length; i++) {
|
|
312
|
-
|
|
315
|
+
let foundValue = Number(cells[i]);
|
|
316
|
+
|
|
317
|
+
if (foundValue < value) {
|
|
313
318
|
throw new Error(`found table cell value ${cells[i]} < ${value}`);
|
|
314
319
|
}
|
|
315
320
|
}
|
|
@@ -317,8 +322,10 @@ class StableBrowser {
|
|
|
317
322
|
if (cells.length === 0) {
|
|
318
323
|
throw new Error("no cells found");
|
|
319
324
|
}
|
|
325
|
+
value = Number(value);
|
|
320
326
|
for (let i = 0; i < cells.length; i++) {
|
|
321
|
-
|
|
327
|
+
let foundValue = Number(cells[i]);
|
|
328
|
+
if (foundValue <= value) {
|
|
322
329
|
throw new Error(`found table cell value ${cells[i]} <= ${value}`);
|
|
323
330
|
}
|
|
324
331
|
}
|
|
@@ -326,8 +333,10 @@ class StableBrowser {
|
|
|
326
333
|
if (cells.length === 0) {
|
|
327
334
|
throw new Error("no cells found");
|
|
328
335
|
}
|
|
336
|
+
value = Number(value);
|
|
329
337
|
for (let i = 0; i < cells.length; i++) {
|
|
330
|
-
|
|
338
|
+
let foundValue = Number(cells[i]);
|
|
339
|
+
if (foundValue > value) {
|
|
331
340
|
throw new Error(`found table cell value ${cells[i]} > ${value}`);
|
|
332
341
|
}
|
|
333
342
|
}
|
|
@@ -335,8 +344,10 @@ class StableBrowser {
|
|
|
335
344
|
if (cells.length === 0) {
|
|
336
345
|
throw new Error("no cells found");
|
|
337
346
|
}
|
|
347
|
+
value = Number(value);
|
|
338
348
|
for (let i = 0; i < cells.length; i++) {
|
|
339
|
-
|
|
349
|
+
let foundValue = Number(cells[i]);
|
|
350
|
+
if (foundValue >= value) {
|
|
340
351
|
throw new Error(`found table cell value ${cells[i]} >= ${value}`);
|
|
341
352
|
}
|
|
342
353
|
}
|