Reverse Offset
Posted: Thu Sep 04, 2008 9:45 pm
So, is this better than using Bugzilla?
Anyway, I'd like to use offset() to search backwards.
In this case, I have an HTML document that is dynamic, generated by a web server that I'm using RR to interface with. I know what the text link is going to be, but I don't know what the URL for the link is going to be (as is the norm for dynamic and database driven sites). So, I'd like to be able to use offset() going forward to find the text of the link, the offset() backward to find the beginning of the tag so I can then follow it.
So, for example, the page might be
<html>
<head>
blah
</head>
<body>
yadda
blah
<a href="2938jfsliusleifu2398she82h3" class="gum">Trick or Treat</a>
<a href="23908hjadp9uasdlkfhj230js" class="tree">Smelly Feet</a>
<a href="209jsalasop93jfli32wel9fj39" class="rooster">Gimme Something Good to eat</a>
</body>
</html>
If I want to follow the "Smelly Feet" link, I either have to ASSUME that the 2nd link on the page is the one I want (and hope hat doesn't change), or (more reliably, IMHO), get the offset of "Smelly Feet", and from there get the backward offset to the link.
Granted you can also solve this problem by just waking backward to the two quotes, but there are other tags that I want to work with that aren't so simple, e.g. FORM tags, that have multiple components.
Anyway, I'd like to use offset() to search backwards.
In this case, I have an HTML document that is dynamic, generated by a web server that I'm using RR to interface with. I know what the text link is going to be, but I don't know what the URL for the link is going to be (as is the norm for dynamic and database driven sites). So, I'd like to be able to use offset() going forward to find the text of the link, the offset() backward to find the beginning of the tag so I can then follow it.
So, for example, the page might be
<html>
<head>
blah
</head>
<body>
yadda
blah
<a href="2938jfsliusleifu2398she82h3" class="gum">Trick or Treat</a>
<a href="23908hjadp9uasdlkfhj230js" class="tree">Smelly Feet</a>
<a href="209jsalasop93jfli32wel9fj39" class="rooster">Gimme Something Good to eat</a>
</body>
</html>
If I want to follow the "Smelly Feet" link, I either have to ASSUME that the 2nd link on the page is the one I want (and hope hat doesn't change), or (more reliably, IMHO), get the offset of "Smelly Feet", and from there get the backward offset to the link.
Granted you can also solve this problem by just waking backward to the two quotes, but there are other tags that I want to work with that aren't so simple, e.g. FORM tags, that have multiple components.