Forum Discussion
Here's an example,
function Assessibility()
{
// Launch browser
Browsers.Item(btChrome).Navigate("https://www.google.com/");
var page = Sys.Browser("chrome").Page("*");
page.Wait();
// Inject script
var script = page.contentDocument.createElement("script");
script.src="https://cdnjs.cloudflare.com/ajax/libs/axe-core/4.8.2/axe.min.js";
script.type = "text/javascript";
page.contentDocument.head.appendChild(script);
// Function call
page.contentDocument.Script.eval("axe.run({resultTypes: ['violations']}, function (err, results) {if (err) throw err; console.log(results);});");
}
The function is called, and the output is shown in DevTools,
If I replace console.log(results) with return results, then the object is not returned. I'm not sure how to retrieve the object, and not sure if it's a limitation of Chrome.
Hopefully, this should be enough to get you going, and if you do find out how to retrieve the object, then please provide the solution.
- Susan_1232 years agoOccasional Contributor
Thanks rraghvani for the example , I was able to achieve the same by injecting below code
in axeScript.textContent as well and see results in console. But even i was not able to return the object so that it can be used later to generate some html results or print the results in testcomplete log.
Hence tried the previously shared approach where i am getting type mismatch error
Will try to retrieve the object, if i get some solution will share the same . Thanks!
- Mukeshmani2 years agoRegular VisitorHi Susan , have you got any luck on the report generation from object
- Susan_1232 years agoOccasional ContributorHi Mukesh,
No luck with report generation from object as I was only able to print object in console couldn't return and fetch the object for further use
Related Content
- 8 years ago
Recent Discussions
- 11 hours ago
- 7 days ago
- 10 days ago