Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Accessing local machine from TestRail UI Scripts



We are evaluating TestRail, so that we can procure it for our organization. We have an automation framework which we want to integrate with TestRail. We are calling ajax from UI Scripts as mentioned below.
url: “” +,

  • I know this is not a public IP so local machine would be able to communicate with TestRail cloud.

Entire solution is working fine when we deployed TestRail server and automation framework in local environment but same is not working when we use TestRail cloud based solution.

Discussed with our IT team, they told TestRail team will have to permit ICMP on the port where TestRail is running.

Please let me know if it is feasible or there is any other way to communicate with local machine.



Thanks for your posting! Browser’s don’t allow cross-site/domain requests for JavaScript and it wouldn’t be possible to implement this directly via JavaScript (this only works if both TestRail and your target server/trigger are located on the machine). Instead, you would implement this slightly differently and as a regular non-JavaScript web request, e.g. as a simple link or a POST request. Do you maybe have a web developer on your team who has experience with this and could help?



Hi Tobias,

We tried with the changes you suggested above but still no success. Please find below the code changes we did:
var url=“”;
var params = “run_id=”+;‘POST’, url, true);
request.onreadystatechange = function() {if (request.readyState==4) alert(“It worked!”);};
request.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
request.setRequestHeader(“Content-length”, params.length);
request.setRequestHeader(“Connection”, “close”);

We also tried with exposing our machine to public ip and found that we were able to access our machine from internet but still not able to hit our local tomcat server from the testrail-cloud based server.


one problem i had was that TestRail sends https, but my address was not https configured. Changing this was then making the call successful



This still looks like a regular JavaScript request. Accessing your local server directly via JS wouldn’t be really possible due to cross domain restrictions by web browsers, but using a regular link without JS (either via GET or POST) would work fine.



This is an excerpt from my script that is working (which again is taken from the TestRail ui script example)

/* Bind the click event to trigger the automated tests */
$("a", button).click(
	url: "" +,
	dataType: "json",
	type: "POST",
	success: function()
	error: function()
			'An error occurred while trying to trigger the automated tests.'

I used for making my local ip available (for testing purposes).


Hi all!

The latest example would also require cross-domain support/permissions if TestRail and the trigger script are located on different servers. It should be possible to enable cross-domain support on your server as follows:



yes - I needed to add the following to my php script

<?php header('Access-Control-Allow-Origin:');

Thanks for pointing that out :slightly_smiling:


Thanks for sharing that, Andreas!

@bijeshkumar: do you/your IT have the option to look into configuring your local server to support this as well? You should then be able to use regular JS requests just like our trigger example.