I am pulling data from a table with picture and Tooltip feature, but I am using javascript separately for picture, tooltip and text.
These are the sources of the data I received;
Table > .innerText
img > .src
img > .alt
The code I use for a single call is as follows.
const getData = (el, includeDuplicates = false) => {
const getTag = [...el.getElementsByTagName('table')].map(asd =>
asd.innerText
);
return includeDuplicates ? getTag : [...new Set(getTag)];
};
getData(document, true);
When I do it according to the code above, it seems empty because I did not introduce the picture and tooltip parts in the table.
What do I need to do to get all the data in a table?
What I have tried:
There are a few methods I tried with ArrayList logic, but I could not get the result I wanted.
const getTag = [...el.getElementsByTagName('table')].map(asd =>
asd.innerText
The best thing I could do was edit this part like this.
const getTag = [...el.getElementsByTagName('table img')].map(asd =>
asd.innerText + asd.alt
With this addition logic, I got the results I wanted, but this time the table view is broken.
While pulling the table, I need to make the "img.alt" query for all the empty places so that it fills automatically. I need your help on how to do it.