Selecting all the elements of a html #95

Closed
opened 2025-10-14 18:09:33 -06:00 by navan · 0 comments
Owner

Originally created by @iCrackk on 4/1/2018

So I want to select all the 'p span' element of the html that looks similar to this:

This is the first one

This is the second one

This is the third one

and this is what my code looks like:
const xray = require('x-ray');
const x = xray();

x(url,'p span')(function(err,product){
if(err == null) console.log(product);
else console.log(err);
})

but the problem is that it only displays the first element that is this:
"This is the first one"

So is there anything that I'm missing? I want to select and display all of the 'p span' elements in this case it would look like:

This is the first one


This is the second one


This is the third one

Any help would be much appreciated.

*Originally created by @iCrackk on 4/1/2018* So I want to select all the 'p span' element of the html that looks similar to this: <div> <p><span>This is the first one</span></p> <p><span>This is the second one</span></p> <p><span>This is the third one</span></p> </div> and this is what my code looks like: const xray = require('x-ray'); const x = xray(); x(url,'p span')(function(err,product){ if(err == null) console.log(product); else console.log(err); }) but the problem is that it only displays the first element that is this: "This is the first one" So is there anything that I'm missing? I want to select and display all of the 'p span' elements in this case it would look like: <p><span>This is the first one</span></p> <p><span>This is the second one</span></p> <p><span>This is the third one</span></p> Any help would be much appreciated.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/x-ray#95
No description provided.