TagUI: Unexpected token '/' - old syntax and outdated TagUI version, try new TagUI and this
I wanted to automate by doing a program but this happened, But This errors give me headache…
SyntaxError: Unexpected token ‘/’
phantomjs://code/updateresults.tag.js:1582 in injectJs phantomjs://code/bootstrap.js:456
The Code is as follows:
// Upadate results on icmr website
// login to icmr cvstatus page tagui login.tag
// Goto cvstatus website https://cvstatus.icmr.gov.in/
// type user name
type username as uname
// type password
type passwd as pwd
//click on login button click login_btn
// load csv file
file_rows= [] csv_file= ‘result.csv’ load ‘+csv_file+’ to lines file_rows = lines.split(‘\n’)
for i from 1 to file_rows.length-1 {
// check data from file
row=[] row=file_rows[i].split(‘,’)
if row[13] equal to 1
record = row[1] + “\n Positive results recorded.”
write record
to failed.txt
echo record
continue
// click on Add Record from SRF Portal
click Add Record from SRF Portal
// type SRF ID
type srf_id as row[1]
// click Search button
click btn
// passing row data of csv to dom_json
dom_json={ recno:i,name:row[2], pid:row[3], sid:row[4], rdate:row[5], stype:row[6], sdate:row[7], kit:row[8], tdate:row[9], egene:row[10], orf:row[11], rdrp:row[12], fresult:row[13] }
// opens the next page to edit wait for 3 seconds to load the page … wait for another 5 sec if delayed in loading the next page wait 3
if url() not equal to “https://cvstatus.icmr.gov.in/add_record.php”
{
echo “page not yet loaded”
wait 5
record = row[1] +“\n SRF ID could not open. Already fetched probably.”
write record
to failed.txt
echo record
continue
}
dom begin
var flg=0
var tmp
if(document.getElementById(“patient_name”).value != dom_json.name)
{
flg=1
}
if(flg==0)
{
document.getElementById(“patient_id”).value= dom_json.pid
document.getElementById(“sample_id”).value = dom_json.sid
document.getElementById(“sample_rdate”).value = dom_json.rdate
document.getElementById(“sample_tdate”).value = dom_json.tdate
document.getElementById(“sample_type”).selectedIndex = dom_json.stype
document.getElementById(“date_of_onset_of_symptoms”).value = dom_json.sdate
document.getElementById(“testing_kit_used”).selectedIndex = dom_json.kit
document.getElementById(“covid19_result_egene”).selectedIndex= dom_json.egene
document.getElementById(“orf1b_confirmatory”).selectedIndex= dom_json.orf
document.getElementById(“rdrp_confirmatory”).selectedIndex= dom_json.rdrp
document.getElementById(“final_result_of_sample”).selectedIndex= dom_json.fresult
if(dom_json.recno==1)
{
var disp="\nPatient_id : "+ document.getElementById(“patient_id”).value
disp+= "\nSample_id : "+ document.getElementById(“sample_id”).value
disp+= "\nSample recieved Date : "+ document.getElementById(“sample_rdate”).value
disp+= "\nSample tested Date : "+ document.getElementById(“sample_tdate”).value
disp+= "\nSample Type : " + document.getElementById(“sample_type”).selectedOptions[0].innerText
disp+= "\nSymptom Date : " + document.getElementById(“date_of_onset_of_symptoms”).value
disp+= "\nTesting kit : " + document.getElementById(“testing_kit_used”).selectedOptions[0].innerText
disp+= "\nResult Egene : "+ document.getElementById(“covid19_result_egene”).selectedOptions[0].innerText
disp+= "\norf1b_confirmatory : "+ document.getElementById(“orf1b_confirmatory”).selectedOptions[0].innerText
disp+= "\nrdrp_confirmatory : "+ document.getElementById(“rdrp_confirmatory”).selectedOptions[0].innerText
disp+= "\nFinal Result : "+ document.getElementById(“final_result_of_sample”).selectedOptions[0].innerText
disp+= “\nPlease press Cancel to stop further submissions”
var tmp= confirm(“verify data submitted”+disp)
if(!tmp)
flg=2
}
}
return flg
dom finish
if dom_result equal to 2 echo HALTED break
if dom_result equals to 1
record = row[1] + “\n Patient Name”
write record
to failed.txt
echo record
else
frecord = row[1]
write frecord
to success.txt
echo "page updated for "+frecord
// click submit button to save changes click btn
// wait for 3 sec to submit the data and reload the page for next iteration wait 3 }
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (5 by maintainers)
@amit018-hub Would also like to add on that, I noticed you included the login credentials to the portal when uploading your flow file here at Github. I hope it is some test account / test site that does not return any actual patient info. If you have overlooked and this is your actual account to the database, it is best if you remove the login credentials here and reset your password to that website ASAP.
Cheers, Ruth
The echo output looks correct -
Please see attached file. Below runs for me. I think the problem is because within dom begin and finish, you should not do indentation. I added an if block. You can try this or you remove the 1 level of indentation for all the lines in dom begin/finish.
updateresults.tag.zip