Forum Discussion

nastester's avatar
nastester
Regular Contributor
10 months ago

Headless execution

I am new to using headless execution with TC and am in the process of converting some existing tests to run headlessly. 

I am able to launch a headless browser using a script with no issues (Browsers.RemoteItem(server, capabilities).Run(url);)

 

Some of my Keyword tests have additional navigates within them using Navigate Current Browser.

What's the best way to handle these while still using a headless browser? Is it possible through a Keyword test using Operations?

 

It seems like I can call a script routine in place of the Navigate statement. But I would have to do this for all cases each with a different url. 

 

function headlessNavigate() {

var server = "localhost";
var capabilities = {
"browserName": "edge",
"screenResolution": "1920x1080"
};

var url = Project.Variables.url;
Browsers.RemoteItem(server, capabilities).Navigate(url)
}

  • You already have an extra call for your additional navigates. Calling a common function with the appropriate URL won't add anything extra, it will replace it. You just need to make that function one common to all the tests and call it with the needed URL from each test that needs it.

2 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    You already have an extra call for your additional navigates. Calling a common function with the appropriate URL won't add anything extra, it will replace it. You just need to make that function one common to all the tests and call it with the needed URL from each test that needs it.

    • nastester's avatar
      nastester
      Regular Contributor

      Thanks, yeah that's essentially what I ended up doing. 

      Wrote a function that took in a URL parameter and then called it in tests that needed an additional navigate within the test.