Extracting alt tags from images yields only the first tag on the page The Next CEO of Stack Overflowextracting contents from a tag “extract” from BeautifulsoupExtracting multimedia tags with alt in PythonBeautifulSoup extract top-level tags onlyTrying to extract only first post from a pageOf the same tags, I want to extract only the tags I wantExtract css from a HTML pagepython asyncronous images download (multiple urls)BeautifulSoup not extracting image alt textExtract text only except the content of script tag from html with BeautifulSoupExtract Text Data from a Div Tag but not a from a Child H3 Tag

Is it reasonable to ask other researchers to send me their previous grant applications?

Simplify trigonometric expression using trigonometric identities

Create custom note boxes

Can you teleport closer to a creature you are Frightened of?

How do I keep Mac Emacs from trapping M-`?

How can I prove that a state of equilibrium is unstable?

Salesforce opportunity stages

Why did the Drakh emissary look so blurred in S04:E11 "Lines of Communication"?

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Do I need to write [sic] when including a quotation with a number less than 10 that isn't written out?

logical reads on global temp table, but not on session-level temp table

What is the difference between 'contrib' and 'non-free' packages repositories?

Does the Idaho Potato Commission associate potato skins with healthy eating?

Free fall ellipse or parabola?

Strange use of "whether ... than ..." in official text

What day is it again?

pgfplots: How to draw a tangent graph below two others?

How does a dynamic QR code work?

Find the majority element, which appears more than half the time

Finitely generated matrix groups whose eigenvalues are all algebraic

How dangerous is XSS

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

Ising model simulation

Man transported from Alternate World into ours by a Neutrino Detector



Extracting alt tags from images yields only the first tag on the page



The Next CEO of Stack Overflowextracting contents from a tag “extract” from BeautifulsoupExtracting multimedia tags with alt in PythonBeautifulSoup extract top-level tags onlyTrying to extract only first post from a pageOf the same tags, I want to extract only the tags I wantExtract css from a HTML pagepython asyncronous images download (multiple urls)BeautifulSoup not extracting image alt textExtract text only except the content of script tag from html with BeautifulSoupExtract Text Data from a Div Tag but not a from a Child H3 Tag










0















I need to extract alt tags from images (only in body text) on a page. The code below fails to grab them all but just the first one on the page.



r = requests.get('https://www.bbc.co.uk/news/uk-politics-47648565')
soup = BeautifulSoup(r.content, "html.parser")

alt_tags = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
alt_tags.append(img['alt'])
print(alt_tags)


Could anyone direct me to a solution? Thanks!



UPD:



When using selenium, as suggested below, sometimes it works but sometimes it still grabs only the first image.



This is the code:



url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome('/Users/vissea01/Downloads/chromedriver')
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

bios = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
bios.append(img['alt'])
bios = [i for i in bios if i != 'Presentational grey line' and i != 'Presentational white space']
print(bios)

driver.close()


The same code outputs:



['Theresa May arriving in Brussels']


OR



['Theresa May arriving in Brussels', 'Analysis box by Katya Adler, Europe editor', 'Brexit timetable', 'Jeremy Corbyn']









share|improve this question
























  • well there is only one image the class image-and-copyright-container

    – Fozoro
    Mar 21 at 19:32















0















I need to extract alt tags from images (only in body text) on a page. The code below fails to grab them all but just the first one on the page.



r = requests.get('https://www.bbc.co.uk/news/uk-politics-47648565')
soup = BeautifulSoup(r.content, "html.parser")

alt_tags = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
alt_tags.append(img['alt'])
print(alt_tags)


Could anyone direct me to a solution? Thanks!



UPD:



When using selenium, as suggested below, sometimes it works but sometimes it still grabs only the first image.



This is the code:



url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome('/Users/vissea01/Downloads/chromedriver')
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

bios = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
bios.append(img['alt'])
bios = [i for i in bios if i != 'Presentational grey line' and i != 'Presentational white space']
print(bios)

driver.close()


The same code outputs:



['Theresa May arriving in Brussels']


OR



['Theresa May arriving in Brussels', 'Analysis box by Katya Adler, Europe editor', 'Brexit timetable', 'Jeremy Corbyn']









share|improve this question
























  • well there is only one image the class image-and-copyright-container

    – Fozoro
    Mar 21 at 19:32













0












0








0








I need to extract alt tags from images (only in body text) on a page. The code below fails to grab them all but just the first one on the page.



r = requests.get('https://www.bbc.co.uk/news/uk-politics-47648565')
soup = BeautifulSoup(r.content, "html.parser")

alt_tags = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
alt_tags.append(img['alt'])
print(alt_tags)


Could anyone direct me to a solution? Thanks!



UPD:



When using selenium, as suggested below, sometimes it works but sometimes it still grabs only the first image.



This is the code:



url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome('/Users/vissea01/Downloads/chromedriver')
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

bios = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
bios.append(img['alt'])
bios = [i for i in bios if i != 'Presentational grey line' and i != 'Presentational white space']
print(bios)

driver.close()


The same code outputs:



['Theresa May arriving in Brussels']


OR



['Theresa May arriving in Brussels', 'Analysis box by Katya Adler, Europe editor', 'Brexit timetable', 'Jeremy Corbyn']









share|improve this question
















I need to extract alt tags from images (only in body text) on a page. The code below fails to grab them all but just the first one on the page.



r = requests.get('https://www.bbc.co.uk/news/uk-politics-47648565')
soup = BeautifulSoup(r.content, "html.parser")

alt_tags = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
alt_tags.append(img['alt'])
print(alt_tags)


Could anyone direct me to a solution? Thanks!



UPD:



When using selenium, as suggested below, sometimes it works but sometimes it still grabs only the first image.



This is the code:



url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome('/Users/vissea01/Downloads/chromedriver')
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

bios = []
bio_img_soup = [s for s in soup.find_all( 'span', 'class': 'image-and-copyright-container')]
for div in bio_img_soup:
for img in div.find_all('img', alt=True):
bios.append(img['alt'])
bios = [i for i in bios if i != 'Presentational grey line' and i != 'Presentational white space']
print(bios)

driver.close()


The same code outputs:



['Theresa May arriving in Brussels']


OR



['Theresa May arriving in Brussels', 'Analysis box by Katya Adler, Europe editor', 'Brexit timetable', 'Jeremy Corbyn']






python-3.x beautifulsoup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 10:52







aviss

















asked Mar 21 at 19:21









avissaviss

490717




490717












  • well there is only one image the class image-and-copyright-container

    – Fozoro
    Mar 21 at 19:32

















  • well there is only one image the class image-and-copyright-container

    – Fozoro
    Mar 21 at 19:32
















well there is only one image the class image-and-copyright-container

– Fozoro
Mar 21 at 19:32





well there is only one image the class image-and-copyright-container

– Fozoro
Mar 21 at 19:32












1 Answer
1






active

oldest

votes


















0














the page is dynamic. when you do the request, that first image is part of the html source code. The other images are rendered after. You can use Selenium to render the page first, then pull all the img tags. You can use Selenium then to get those tags, or if you're like me and just feel more comfortable with bs4, you can use that.



from selenium import webdriver
from selenium.webdriver.common.by import By
import bs4
import pandas as pd

url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

imgs = soup.find_all('img', alt=True)

for img in imgs:
print (img['alt'])

driver.close()


Output:



Theresa May arriving in Brussels
Presentational grey line
Presentational grey line
Presentational grey line
Analysis box by Katya Adler, Europe editor
Presentational grey line
Brexit timetable
Presentational white space
Jeremy Corbyn
Theresa May arriving in Brussels
Anti-Brexit protests
Police at Parliament
‘It’s actually really good to get rejected’
How Brexit changed the English language
A forgotten food of the American South
Why water is one of the weirdest things in the Universe
What happens when we run out of food?
Canada's lake of methane
Imprints on the Sands of Time
Air India suspends Birmingham flights
Hen party mum to be buried in wedding dress
Is Kosovo’s capital city the ugliest in Europe?
Can a film be banned in the US?
Christine Chubbuck: The broadcaster who shot herself on air
[Gallery] The Worst Food From Every Single State
3 Ways Your Dog Asks For Help
[Gallery] This Is The Reason Clint Eastwood Never Discussed His Military Service
Seniors With No Life Insurance Feel Silly For Not Knowing This
No It's Not Oregano -- But This Plant Could Help You Retire Filthy Rich
This Holistic Remedy Improves Nail Fungus
Guns
Lauren and Dan Perkins with their six children
cyclone
Girl
Computer graphics
Guatemala village
Paris and Nanchanok
Kenyan boys and fishermen on Lake Victoria
Jacinda Ardern hugs woman
football being kicked on a field - Vauxhall image blurred in the background.





share|improve this answer























  • Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

    – aviss
    Mar 22 at 8:37











  • Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

    – aviss
    Mar 22 at 8:48











  • 1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

    – chitown88
    Mar 22 at 9:07











  • Updated my question.

    – aviss
    Mar 22 at 10:52











  • thanks. I'm going to start playing with it now to see if I can find the issue

    – chitown88
    Mar 22 at 11:00











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287861%2fextracting-alt-tags-from-images-yields-only-the-first-tag-on-the-page%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














the page is dynamic. when you do the request, that first image is part of the html source code. The other images are rendered after. You can use Selenium to render the page first, then pull all the img tags. You can use Selenium then to get those tags, or if you're like me and just feel more comfortable with bs4, you can use that.



from selenium import webdriver
from selenium.webdriver.common.by import By
import bs4
import pandas as pd

url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

imgs = soup.find_all('img', alt=True)

for img in imgs:
print (img['alt'])

driver.close()


Output:



Theresa May arriving in Brussels
Presentational grey line
Presentational grey line
Presentational grey line
Analysis box by Katya Adler, Europe editor
Presentational grey line
Brexit timetable
Presentational white space
Jeremy Corbyn
Theresa May arriving in Brussels
Anti-Brexit protests
Police at Parliament
‘It’s actually really good to get rejected’
How Brexit changed the English language
A forgotten food of the American South
Why water is one of the weirdest things in the Universe
What happens when we run out of food?
Canada's lake of methane
Imprints on the Sands of Time
Air India suspends Birmingham flights
Hen party mum to be buried in wedding dress
Is Kosovo’s capital city the ugliest in Europe?
Can a film be banned in the US?
Christine Chubbuck: The broadcaster who shot herself on air
[Gallery] The Worst Food From Every Single State
3 Ways Your Dog Asks For Help
[Gallery] This Is The Reason Clint Eastwood Never Discussed His Military Service
Seniors With No Life Insurance Feel Silly For Not Knowing This
No It's Not Oregano -- But This Plant Could Help You Retire Filthy Rich
This Holistic Remedy Improves Nail Fungus
Guns
Lauren and Dan Perkins with their six children
cyclone
Girl
Computer graphics
Guatemala village
Paris and Nanchanok
Kenyan boys and fishermen on Lake Victoria
Jacinda Ardern hugs woman
football being kicked on a field - Vauxhall image blurred in the background.





share|improve this answer























  • Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

    – aviss
    Mar 22 at 8:37











  • Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

    – aviss
    Mar 22 at 8:48











  • 1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

    – chitown88
    Mar 22 at 9:07











  • Updated my question.

    – aviss
    Mar 22 at 10:52











  • thanks. I'm going to start playing with it now to see if I can find the issue

    – chitown88
    Mar 22 at 11:00















0














the page is dynamic. when you do the request, that first image is part of the html source code. The other images are rendered after. You can use Selenium to render the page first, then pull all the img tags. You can use Selenium then to get those tags, or if you're like me and just feel more comfortable with bs4, you can use that.



from selenium import webdriver
from selenium.webdriver.common.by import By
import bs4
import pandas as pd

url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

imgs = soup.find_all('img', alt=True)

for img in imgs:
print (img['alt'])

driver.close()


Output:



Theresa May arriving in Brussels
Presentational grey line
Presentational grey line
Presentational grey line
Analysis box by Katya Adler, Europe editor
Presentational grey line
Brexit timetable
Presentational white space
Jeremy Corbyn
Theresa May arriving in Brussels
Anti-Brexit protests
Police at Parliament
‘It’s actually really good to get rejected’
How Brexit changed the English language
A forgotten food of the American South
Why water is one of the weirdest things in the Universe
What happens when we run out of food?
Canada's lake of methane
Imprints on the Sands of Time
Air India suspends Birmingham flights
Hen party mum to be buried in wedding dress
Is Kosovo’s capital city the ugliest in Europe?
Can a film be banned in the US?
Christine Chubbuck: The broadcaster who shot herself on air
[Gallery] The Worst Food From Every Single State
3 Ways Your Dog Asks For Help
[Gallery] This Is The Reason Clint Eastwood Never Discussed His Military Service
Seniors With No Life Insurance Feel Silly For Not Knowing This
No It's Not Oregano -- But This Plant Could Help You Retire Filthy Rich
This Holistic Remedy Improves Nail Fungus
Guns
Lauren and Dan Perkins with their six children
cyclone
Girl
Computer graphics
Guatemala village
Paris and Nanchanok
Kenyan boys and fishermen on Lake Victoria
Jacinda Ardern hugs woman
football being kicked on a field - Vauxhall image blurred in the background.





share|improve this answer























  • Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

    – aviss
    Mar 22 at 8:37











  • Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

    – aviss
    Mar 22 at 8:48











  • 1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

    – chitown88
    Mar 22 at 9:07











  • Updated my question.

    – aviss
    Mar 22 at 10:52











  • thanks. I'm going to start playing with it now to see if I can find the issue

    – chitown88
    Mar 22 at 11:00













0












0








0







the page is dynamic. when you do the request, that first image is part of the html source code. The other images are rendered after. You can use Selenium to render the page first, then pull all the img tags. You can use Selenium then to get those tags, or if you're like me and just feel more comfortable with bs4, you can use that.



from selenium import webdriver
from selenium.webdriver.common.by import By
import bs4
import pandas as pd

url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

imgs = soup.find_all('img', alt=True)

for img in imgs:
print (img['alt'])

driver.close()


Output:



Theresa May arriving in Brussels
Presentational grey line
Presentational grey line
Presentational grey line
Analysis box by Katya Adler, Europe editor
Presentational grey line
Brexit timetable
Presentational white space
Jeremy Corbyn
Theresa May arriving in Brussels
Anti-Brexit protests
Police at Parliament
‘It’s actually really good to get rejected’
How Brexit changed the English language
A forgotten food of the American South
Why water is one of the weirdest things in the Universe
What happens when we run out of food?
Canada's lake of methane
Imprints on the Sands of Time
Air India suspends Birmingham flights
Hen party mum to be buried in wedding dress
Is Kosovo’s capital city the ugliest in Europe?
Can a film be banned in the US?
Christine Chubbuck: The broadcaster who shot herself on air
[Gallery] The Worst Food From Every Single State
3 Ways Your Dog Asks For Help
[Gallery] This Is The Reason Clint Eastwood Never Discussed His Military Service
Seniors With No Life Insurance Feel Silly For Not Knowing This
No It's Not Oregano -- But This Plant Could Help You Retire Filthy Rich
This Holistic Remedy Improves Nail Fungus
Guns
Lauren and Dan Perkins with their six children
cyclone
Girl
Computer graphics
Guatemala village
Paris and Nanchanok
Kenyan boys and fishermen on Lake Victoria
Jacinda Ardern hugs woman
football being kicked on a field - Vauxhall image blurred in the background.





share|improve this answer













the page is dynamic. when you do the request, that first image is part of the html source code. The other images are rendered after. You can use Selenium to render the page first, then pull all the img tags. You can use Selenium then to get those tags, or if you're like me and just feel more comfortable with bs4, you can use that.



from selenium import webdriver
from selenium.webdriver.common.by import By
import bs4
import pandas as pd

url = 'https://www.bbc.co.uk/news/uk-politics-47648565'

driver = webdriver.Chrome()
driver.get(url)

html = driver.page_source
soup = bs4.BeautifulSoup(html, "html.parser")

imgs = soup.find_all('img', alt=True)

for img in imgs:
print (img['alt'])

driver.close()


Output:



Theresa May arriving in Brussels
Presentational grey line
Presentational grey line
Presentational grey line
Analysis box by Katya Adler, Europe editor
Presentational grey line
Brexit timetable
Presentational white space
Jeremy Corbyn
Theresa May arriving in Brussels
Anti-Brexit protests
Police at Parliament
‘It’s actually really good to get rejected’
How Brexit changed the English language
A forgotten food of the American South
Why water is one of the weirdest things in the Universe
What happens when we run out of food?
Canada's lake of methane
Imprints on the Sands of Time
Air India suspends Birmingham flights
Hen party mum to be buried in wedding dress
Is Kosovo’s capital city the ugliest in Europe?
Can a film be banned in the US?
Christine Chubbuck: The broadcaster who shot herself on air
[Gallery] The Worst Food From Every Single State
3 Ways Your Dog Asks For Help
[Gallery] This Is The Reason Clint Eastwood Never Discussed His Military Service
Seniors With No Life Insurance Feel Silly For Not Knowing This
No It's Not Oregano -- But This Plant Could Help You Retire Filthy Rich
This Holistic Remedy Improves Nail Fungus
Guns
Lauren and Dan Perkins with their six children
cyclone
Girl
Computer graphics
Guatemala village
Paris and Nanchanok
Kenyan boys and fishermen on Lake Victoria
Jacinda Ardern hugs woman
football being kicked on a field - Vauxhall image blurred in the background.






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 21 at 23:23









chitown88chitown88

5,5211627




5,5211627












  • Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

    – aviss
    Mar 22 at 8:37











  • Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

    – aviss
    Mar 22 at 8:48











  • 1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

    – chitown88
    Mar 22 at 9:07











  • Updated my question.

    – aviss
    Mar 22 at 10:52











  • thanks. I'm going to start playing with it now to see if I can find the issue

    – chitown88
    Mar 22 at 11:00

















  • Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

    – aviss
    Mar 22 at 8:37











  • Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

    – aviss
    Mar 22 at 8:48











  • 1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

    – chitown88
    Mar 22 at 9:07











  • Updated my question.

    – aviss
    Mar 22 at 10:52











  • thanks. I'm going to start playing with it now to see if I can find the issue

    – chitown88
    Mar 22 at 11:00
















Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

– aviss
Mar 22 at 8:37





Hmm, I still get only the first alt tag. Also - I need alt tags only from the body text, not everything.

– aviss
Mar 22 at 8:37













Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

– aviss
Mar 22 at 8:48





Ok, even with selenium the page sometimes loads fully and sometimes it doesn't...

– aviss
Mar 22 at 8:48













1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

– chitown88
Mar 22 at 9:07





1) Can you edit/ add additional code above to show exactly the code you’re using with selenium that sometimes doesn’t load fully? And 2) in your question you state you want alt tag for all images on the page. So maybe edit that also to specify you mean body.

– chitown88
Mar 22 at 9:07













Updated my question.

– aviss
Mar 22 at 10:52





Updated my question.

– aviss
Mar 22 at 10:52













thanks. I'm going to start playing with it now to see if I can find the issue

– chitown88
Mar 22 at 11:00





thanks. I'm going to start playing with it now to see if I can find the issue

– chitown88
Mar 22 at 11:00



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287861%2fextracting-alt-tags-from-images-yields-only-the-first-tag-on-the-page%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript