![]() ![]() |
I'm on an full page ad I want to skip - there's this link:
<a href="http://www.newsfactor.com/news/Panasonic--Best-Buy-To-Push-3-D-TV/story.xhtml?story_id=0200029Q08EG&full_skip=1"><!--b-->Go Directly to NewsFactor.com<!--/b--></a> _____________________ // #1 using the text of the link
3-D-TV%2Fstory.xhtml%3Fstory_id%3D0200029Q08EG
var input = document.evaluate('//a[contains(.,"Go Directly to NewsFactor.com")]',document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
if (input) {
location.href = input.href
}
Result - success. _____________________ // #2 using the href
var input = document.evaluate('//a[@href[contains(.,"&full_skip=1")]]',document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
if (input) {
location.href = input.href
}
Result - failure. Why doesn't it work? |
![]() ![]() |
Shouldn't it be this?:
|
![]() ![]() |
ekbworldwide wrote:u checking the link text not @hrefcontains(.,"&full_skip=1") also remember, that & symbol might be & but it shows up in firebug as &ive tried to match hrefs by only using firebug, and i would use regex like /&something=(.*)/ but actually the & was & so i had to use /(?:&|&)something=(.*)/
|
![]() ![]() |
u checking the link text not @href document.evaluate |
![]() ![]() |
ekbworldwide wrote:Have a look at my post above :p ekbworldwide wrote:You can't use Regexp inside a XPath expression, you can only loop over the resulting elements and compare things like .href and .textContent against a regexp
|
![]() ![]() |
Have a look at my post above :p Oops, again. My mind is empty today - and not in the good zen-like way. |


