Try
Wrap your code in $(document).ready(function(){...}
$(document).ready(function(){ $('.test').click(); }); Update
Read Open a URL in a new tab (and not a new window)Open a URL in a new tab (and not a new window)
.click() and .trigger('click') will execute the functions which are attached to the click event.