Hi,
First of all, there is this project I posted at
this post. Now, I'm not sure if this applies to your case. What it does is to navigate through the "next" button in a set of result pages until the "next" button is not found anymore. So it's basically an easy way to navigate through all pages in a set of result pages. Problem is that I see on your screenshot that the last page still has a "next" button. What you can do is create a kind that selects the "next" button in the first and some other pages but NOT in the last page, and then see if the kind selects the "next" button in the last page. If it doesn't, then you can use that project.
Here is a sample code that should help you with the string manipulation thing you are trying to do. Just paste it into a "Execute JavaScript" so it looks nicely colored and so you can see how it works.
Code: Select all
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g, "");
}
// Find text between two strings. This function is case sensitive ("A" is not the same as "a")
String.prototype.textBetween = function(strLeft, strRight)
{
indexOfStrLeft = this.indexOf(strLeft);
indexOfStrRight = this.lastIndexOf(strRight);
if(indexOfStrLeft != -1 && indexOfStrRight != -1)
return this.substring(indexOfStrLeft + strLeft.length, indexOfStrRight);
else return null;
}
// Loaded it with whitespaces on the sides just to make sure the trim() function is working OK
var text = " Page 2 Of 16 ";
text = text.trim();
// Note the space after "Page" and before "Of". This way I get the number with no spaces.
// Also note I'm using " Of" instead of " of". " of" wouldn't work.
var currentPage = text.textBetween("Page ", " Of");
var lastPage = text.textBetween(" Of", "");
alert("currentPage: " + currentPage);
alert("lastPage: " + lastPage);
// currentPage is actually bigger than lastPage AS STRINGS (alphabetically)
alert("Is currentPage less than lastPage? " + (currentPage < lastPage)); // No!!!
// Turn this strings into numbers
currentPage = parseInt(currentPage);
lastPage = parseInt(lastPage);
alert("Is currentPage less than lastPage now? " + (currentPage < lastPage)); // Yes
Now straight to your questions:
1) No. There is no
UserData2, but the following code (that is somewhere in your project):
Code: Select all
function TreeData()
{
this.Current = 0;
this.Data = null;
}
defines the object that will be assigned to
Tree.UserData, so to add extra information you would to this:
Code: Select all
function TreeData()
{
this.Current = 0;
this.Data = null;
this.ExtraData = null;
this.MoreExtraData = null;
}
Then, after assigning a
new TreeData to
UserData, you can access these propertise like this
Tree.UserData.ExtraData = "whatever";.
2) Not if you use the code above.
3) That should be fixed if you add a "Wait" right after (or INSIDE as a first child node if it is a "Navigate each" action) whatever action navigates. Start with a 2 seconds one just to make sure this fixes it. Then you can lower it.
Let me know how it goes.