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

0 votes
How can I get meta-description of a webpage using Selenium Webdriver?
Jul 22 in Selenium by Sonal
48 views

1 answer to this question.

0 votes

Hey Sonal, to get the meta-description of a webpage, you can simply use findElement() and getAttribute() methods in Selenium Webdriver:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Abha_Rathour\\Downloads\\chromedriver_win32\\chromedriver.exe");

WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.edureka.co/");
System.out.println(driver.findElement(By.xpath("//meta[@name='description']")).getAttribute("content"));
answered Jul 23 by Abha
• 19,440 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

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,050 points
413 views
0 votes
1 answer
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,130 points
772 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
408 views
0 votes
1 answer
0 votes
1 answer

How can I verify Error Message on a webpage using Selenium Webdriver?

Hey Hansraj, to verify an error message ...READ MORE

answered Jul 18 in Selenium by Abha
• 19,440 points
35 views