18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Why I'm getting [Script error. (:)]?

AneeshAneesh Members
edited March 2018 in Sahi Pro
I'm getting [Script error. (:)] on Script Report for most of my tests. It is showing up for both successful and failure tests. What does it mean and Why I'm getting it?

Following is one sample script.
var $url;
var $num = Number(_getText(_span("num-comments ")));
_set($url, window.location.href);
if ($url == "https://www.organicfacts.net/"){
	_assertNotVisible(_div("decomments-comment-section"));
}
else{
	if($num==0){
		_assertVisible(_div("decomments-comment-section"));
		_assertVisible(_div("To comment, please sign-in with any of the social networks below"));
	}
	else{
		_click(_link("Reply"));
		_assertVisible(_div("decomments-form-add-comment"));
	}
}

Test page: https://www.organicfacts.net/health-benefits/fruit/health-benefits-of-apple.html

Any kind of help or information is highly appreciated.

Best Answers

  • Answer ✓
    Hi Aneesh,

    These errors denote javascript errors in your web application (which you should be able to see on the web developer console of your browser). These errors may or may not cause your scenario navigation to fail. Your end user may be able to use your web application as intended, but if they opened the developer console, they would see these errors.

    Regards,
    Narayan
  • edited March 2018 Answer ✓
    If you do not wish to see the errors, you can add the onJSError() function in your script or global_include.sah
    onJSError.noLog= true;
    
    function onJSError($s){
    	return true;
    }
    _setXHRReadyStatesToWaitFor("2,3")
    _navigateTo("https://www.organicfacts.net/health-benefits/fruit/health-benefits-of-apple.html");
    _assertVisible(_image("Organic Facts"));
    _call(location.reload());
    _assertVisible(_image("Organic Facts"));
    _call(location.reload());
    _assertVisible(_image("Organic Facts"));
    _call(location.reload());
    
    


Answers

  • AneeshAneesh Members
    Thank you Narayan and Pratik for your kind help. It was really helpful to have your input. I really appreciate your guidance, and the time you spent with me to solve my problem.
Sign In or Register to comment.