如何can I get meta-description of a webpage using Selenium Webdriver?
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("xxxxxx"); System.out.println(driver.findElement(By.xpath("//meta[@name='description']")).getAttribute("content"));