The sequence
store | true | !StatusOK
Doesn't store true. It stores "true" wit…ch is FALSE. Boolean(true), boolean(true), Boolean(1) or boolean(1) also don't work they are all stores between "" as text. So I couldnt find anyway to change the !StatusOK to true, in my code I just changed my if to ${!LastCommandOK}
I will send in other both the JSON and the HTML (+ autorun) since in the other post people were doing the same.
**JSON**
{
"Name": "test 1 if -3",
"CreationDate": "2019-10-16",
"Commands": [
{
"Command": "open",
"Target": "https://gogoanime.video/",
"Value": ""
},
{
"Command": "store",
"Target": "1",
"Value": "i"
},
{
"Command": "while_v2",
"Target": "(${i} <=18)",
"Value": "i"
},
{
"Command": "store",
"Target": "true",
"Value": "!errorIgnore"
},
{
"Command": "store",
"Target": "true",
"Value": "!STATUSOK"
},
{
"Command": "echo",
"Target": "Loop=${i}",
"Value": "blue"
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"load_recent_release\"]/div[2]/ul/li[${i}]/p[2]",
"Value": "x"
},
{
"Command": "echo",
"Target": "${x}",
"Value": "red"
},
{
"Command": "assertText",
"Target": "xpath=//*[@id=\"load_recent_release\"]/div[2]/ul/li[${i}]/p[2]",
"Value": "*3*"
},
{
"Command": "if_v2",
"Target": "${!statusOK} == true",
"Value": ""
},
{
"Command": "echo",
"Target": "YES",
"Value": "blue"
},
{
"Command": "else",
"Target": "",
"Value": ""
},
{
"Command": "echo",
"Target": "NAO",
"Value": "red"
},
{
"Command": "end",
"Target": "",
"Value": ""
},
{
"Command": "executeScript",
"Target": "return Number(${i})+1",
"Value": "i"
},
{
"Command": "end",
"Target": "",
"Value": ""
},
{
"Command": "echo",
"Target": "done!",
"Value": "green"
}
]
}
**HTML (+autorun)**
<?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>test 1 if -3</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">test 1 if -3</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>https://gogoanime.video/</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>i</td>
</tr>
<tr>
<td>while_v2</td>
<td>(${i} <=18)</td>
<td>i</td>
</tr>
<tr>
<td>store</td>
<td>true</td>
<td>!errorIgnore</td>
</tr>
<tr>
<td>store</td>
<td>true</td>
<td>!STATUSOK</td>
</tr>
<tr>
<td>echo</td>
<td>Loop=${i}</td>
<td>blue</td>
</tr>
<tr>
<td>storeText</td>
<td>xpath=//*[@id="load_recent_release"]/div[2]/ul/li[${i}]/p[2]</td>
<td>x</td>
</tr>
<tr>
<td>echo</td>
<td>${x}</td>
<td>red</td>
</tr>
<tr>
<td>assertText</td>
<td>xpath=//*[@id="load_recent_release"]/div[2]/ul/li[${i}]/p[2]</td>
<td>*3*</td>
</tr>
<tr>
<td>if_v2</td>
<td>${!statusOK} == true</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>YES</td>
<td>blue</td>
</tr>
<tr>
<td>else</td>
<td></td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>NAO</td>
<td>red</td>
</tr>
<tr>
<td>end</td>
<td></td>
<td></td>
</tr>
<tr>
<td>executeScript</td>
<td>return Number(${i})+1</td>
<td>i</td>
</tr>
<tr>
<td>end</td>
<td></td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>done!</td>
<td>green</td>
</tr>
</tbody></table>
<script>
(function() {
var isExtensionLoaded = function () {
const $root = document.documentElement
return !!$root && !!$root.getAttribute('data-kantu')
}
var increaseCountInUrl = function (max) {
var url = new URL(window.location.href)
var count = 1 + (url.searchParams.get('reload') || 0)
url.searchParams.set('reload', count)
var nextUrl = url.toString()
var shouldStop = count > max
return [shouldStop, !shouldStop ? nextUrl : null]
}
var run = function () {
try {
var evt = new CustomEvent('kantuSaveAndRunMacro', { detail: { html: document.documentElement.outerHTML, storageMode: 'browser' } })
window.dispatchEvent(evt)
setInterval(() => window.dispatchEvent(evt), 1000);
if (window.location.protocol === 'file:') {
var onInvokeSuccess = function () {
clearTimeout(timer)
clearTimeout(reloadTimer)
window.removeEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
var timer = setTimeout(function () {
alert('Error #203: It seems you need to turn on *Allow access to file URLs* for Kantu in your browser extension settings.')
}, 8000)
window.addEventListener('kantuInvokeSuccess', onInvokeSuccess)
}
} catch (e) {
alert('Kantu Bookmarklet error: ' + e.toString());
}
}
var reloadTimer = null
var main = function () {
if (isExtensionLoaded()) return run()
var MAX_TRY = 3
var INTERVAL = 1000
var tuple = increaseCountInUrl(MAX_TRY)
if (tuple[0]) {
return alert('Error #204: It seems Kantu is not installed yet - or you need to turn on *Allow access to file URLs* for Kantu in your browser extension settings.')
} else {
reloadTimer = setTimeout(function () {
window.location.href = tuple[1]
}, INTERVAL)
}
}
main()
})();
</script>
</body>
</html>