JSFiddle - React, Tailwind, and code Playground
by elkin0727
HTML
<div id="text"></div>
JavaScript
var json = {
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "http://localhost:8001/jquery/test/app/index.html?scenario=aaaaa&test=bbbbb"
},
{
"type": "clickElement",
"locator": {
"type": "link text",
"value": "INBOX"
}
},
{
"type": "clickElement",
"locator": {
"type": "xpath",
"value": "//table[@id='ui-network-wp-app-inbox-grid-cases']/tbody/tr[3]/td[4]/div/ul/li/span"
}
},
{
"type": "verifyText",
"locator": {
"type": "xpath",
"value": "//ol[@class='organization-plan-task-list']/li[3]/div/p"
},
"text": "Actividad 6"
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 60
};
//////////////////////////////
//////////////////////////////
var newJson = JSON.parse(JSON.stringify(json));
newJson.steps = [];
for(iStep = 0; iStep < json.steps.length; iStep++){
if(json.steps[iStep].type=="clickElement" || json.steps[iStep].type == "setElementText")
{
var sleepStep = {
"type": "pause",
"waitTime": "500"
};
//newJson.steps.push(sleepStep);
var step = JSON.parse(JSON.stringify(json.steps[iStep]));
//modify type step to waitStep
step.type = "waitForElementPresent";
newJson.steps.push(step);
}
newJson.steps.push(json.steps[iStep]);
}
document.getElementById('text').innerHTML = JSON.stringify(newJson);