Given this HTML on the target page:
<dd class="ddTit">
<a href="http://abc.xxx.com/54781.html" target="_blank">special text words</a>
</dd>
How can I get the url based on the "special text words", and do the click in a Greasemonkey script?
I tried this:
var textlink = document.querySelector ("dd.ddTit a[textContent*='special']");
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
textlink.dispatchEvent (clickEvent);
with no luck.
How do I select based on the textContent
, such as textContent
contains the word special?