Generators probably only add overhead here since there is nothing asynchronous happening. You can just as well wrap the first version in a function and return an array:
xpath("//text()[contains(., 'Hello')]").forEach(...)