Declined
Last Updated: 14 Dec 2023 10:06 by ADMIN
ADMIN
Boyan Boev
Created on: 04 Feb 2013 12:00
Type: Feature Request
3
Add an expression, which can find an element by invoking Javascript
There should be a possibility to find an element by directly invoking a Javascript.
1 comment
Imported User
Posted on: 06 Jun 2013 19:12
Boyan, we've been able to use a combination of Find Expressions (or the Find property), and Actions.InvokeScript. (http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/advanced-topics/javascript/invoking-javascript.aspx)
You could have a Javascript function in your test, or one as part of your application, that returns an element's ID. You can pass this into Find.ById.
For example:
var id = Actions.InvokeScript("(function() { return jQuery('.highlighted').first().attr('id'); })()");
var element = ActiveBrowser.Find.ById(id);
The above could be run if jQuery were defined on the page under test.