Can I get meta-description of a webpage using selenium webdriver with python

+1 vote
Can I get meta-description of a webpage using selenium webdriver with python?
Jul 31, 2019 in Selenium by Arpit
3,535 views

1 answer to this question.

+1 vote

Hi Arpit, you can use this code snippet to get meta-description of a webpage:

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://www.edureka.co/")
print(driver.find_element_by_xpath("//meta[@name='description']")).getAttribute("content"))
answered Jul 31, 2019 by Anvi
• 14,150 points
I am getting below error on using a similar code for og:description above.

driver.FindElement(By.XPath("//meta[@property='og:description']")).GetAttribute("content");

'no such element: Unable to locate element: {"method":"xpath","selector":"//meta[@property='og:description']"}.
Hey @jamuna, look for the page source and check if there's a <div> associated with the attribute that you have mentioned. Seems like you have specified a wrong xpath.

Related Questions In Selenium

0 votes
1 answer

How can I get meta-description of a webpage using Selenium Webdriver?

Hey Sonal, to get the meta-description of ...READ MORE

answered Jul 23, 2019 in Selenium by Abha
• 28,140 points
5,307 views
0 votes
1 answer

Get coordinates or dimensions of element with Python using Selenium WebDriver

WebElements have the properties such as .size and .location. ...READ MORE

answered Jul 11, 2018 in Selenium by Meci Matt
• 9,460 points
8,551 views
0 votes
1 answer
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,140 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,619 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,572 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,629 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP