I am working Loadrunner 12.55, and Using TrueClient Protocol to design script for my application.
I have been blocked in an issue, where for each iteration the script should click on random object in the list . Not able to achieve this through normal Parameterization provided by TrueClient.(It doesn't allow me to parameterize Action itself).
Below is the step configuration i tried but didn't work:
Click on PerfTest3
Roles: "javascript_link, focusable, element"
Name: PerfTest3
ID Method: JavaScript
JavaScript =
var linkList = document.getElementsByTagName("a");
random(linkList);
Logic to randomly click objects on the page needs to be written in javascript? Please assist me to solve this issue.
PFB screenshot for further understanding the problem.
Thanks in advance
As far as I see your solution to use JavaScript identification and to use the random method that is defined inside the JavaScript identification context is a good one. W
hen trying it myself it worked with your code as well but maybe in your case, this is a more complicated DOM hierarchy and in that case, you might want to use the evalXPath method instead of the getElementsByTagName method and change the simple “//a” to something more custom for your application:
var linkList = evalXPath("//a");
random(linkList);
you can also try to use Descriptors and change the identification to this:
Related
For a f:link show action in my fluid list template i want to pass a javascript variable to the arguments, basically the uid (to pass that specific object to the showAction), but it doesn't work the way i intend to do it. Is there a workaround for this particular problem?
The naked template looks like this:
<f:for each="{termins}" as="termin">
<tr>
<td><f:link.action action="show" arguments="{termin : termin}"> {termin.mitarbeiter}</f:link.action></td>
<td><f:link.action action="show" arguments="{termin : termin}"> {termin.kunde}</f:link.action></td>
</tr>
</f:for>
</table>
You can't - and you also can't (read: never should) generate links to controller actions from JS since it needs to generate a security checksum. Modifying the URL you create will generate a security error. The checksum exists to prevent DDOS so it has good reason.
There are two options:
You can generate all links in advance
You can make a link-generating service that you call with XHR to generate the necessary links from JS.
Only the first one is appropriate to your use case. Especially so since you want to pass UID values which always refer to an object in the database - which means you can easily generate a list of links to all possible detail views, then read/pass that list of links from your JS to select the right one.
The JS is something working after the fluid template. The right order is, your fluid template is parsed into the HTML, and then the browser render the HTML/JS/CSS to you. So, you can not expect to use JS value in your fluid template.
There are 2 possibilities:
1) Instead of a link use a form and transmit it via POST. Set a form field dynamically with JavaScript. That way your variable isn't included in the (cHash-) checksum.
2) Create an AJAX action that accepts your variable as argument. Let it generate a valid link. Use POST to call it with your variable data. Show the link on your page with JavaScript.
I'm working on an Android app and trying to implement the following solution:
within an HtmlDrawable I have a set of elements with onClick events.
By clicking on these elements I want to communicate back to the Java code of the app using the "architectsdk://" url technique.
But I don't see any response in my ArchitectView.ArchitectUrlListener() implementation.
Another note: when I set onClick event of the HtmlDrawable itself then I successfully notified within the Java code.
So the question: is it possible to communicate back to Java code from an HtmlDrawable or I need to create each element separatly and places onclicks on them?
Thanks in advance.
I've got an answer on the Wikitude's forum:
In case if someone needs it:
HtmlDrawables live in a different context, you therefore cannot use
architectsdk to communication with native Android/iOS urlListener. I
recommend using HtmlDrawables onClick listener instead.
e.g. myHtmlDrawables.onClick = function() {
document.location="architectsdk://mydrawables?clicked=1"; return true;
}
Best regards
I am writing an application to list or update users using Javascript. I have enabled the relevant API's in dev console. This all works ok if I use AdminDirectory.Users.list, however when I try to get a single user via AdminDirectory.Users.get and pass the google ID as the key, I get Login Required.
I have tried to add option .viewType = "domain_public" but to no avail.
For now, Im going to re-write the local function that uses .get to get the user via list, but would like to know if anyone else has this problem or know how to fix it.
I ran into the same issue when I tried to write a custom function to retrieve the users in our directory. After reading Paul's comment, I checked and found that custom functions operate with same minimal permissions, so I also added a custom menu to load the users.
At risk of giving advice without testing it myself: for triggers, you'll need to use an event with an authMode value of FULL.
See the Google Apps Script Event Objects guide.
I'm trying to retrieve some information from Gmail but have been unsuccessful after many attempts. This is the line of code that I'm trying to extract using javascript.
Inbox (182)
Im trying to get the text "Inbox (182)," to do that, I'm using this piece of code
NSString *js_result = [webview1 stringByEvaluatingJavaScriptFromString:#"document.getElementsByClassName('J-Ke n0').innerText"];
This however does not work, my result being nothing at all, and I've tried many alternatives but none have worked. All I need to do here is extract the "Inbox (182)" text in any way possible. Thanks.
I think your javascript is incorrect, since there are multiple elements with that class. If I login to gmail, this works:
document.getElementsByClassName('J-Ke n0')[0].innerText
I would be weary of using this in a production environment, though. It seems very brittle; that class or order of elements could be changed by Google at any time.
You also need to make sure that the page has loaded before trying to execute javascript. Typically this is implemented in a webViewDidFinishLoad: callback. If you're not getting a result and your JS is valid, this is probably the issue.
I was looking at code provided at
https://stackoverflow.com/questions/10978236/pass-a-parameter-to-a-crm-2011-workflow-via-the-api
which is supposed to create a Note via javascript. In this code there is a line which reads:
var orgService = GetOrganizationService();
Do I have to have another function "GetOrganizationService"? If so, can someone show me how to do this? Or is this a built-in CRM method that will be understood?
I don't know any function like that, my guess is that method is part of a api that someone create to abstract all the work to call for example the Web Services of CRM via Javascript. For example of a api check this article have a example of a annotation.
I know two ways to create a record of entity via Javascript:
Via Web Services of CRM:
http://msdn.microsoft.com/en-us/library/cc677070.aspx
Via Odata:
http://lakshmanindian.wordpress.com/2012/10/07/create-noteannotation-using-jscript-in-microsoft-dynamics-crm-2011/