Latest Posts

Get Title, URL and Source Code of Webpage

import org.openqa.selenium.WebDriver; import; public class DemoClass3 { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("",C:\\Work\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get(""); System.out.println("Title of webpage is :" +driver.getTitle()); // we fetch title of webpage System.out.println("URL of webpage is : " +driver.getCurrentUrl()); // we fetch url of webpage System.out.println("Source Code of the page is : " +driver.getPageSource()); // fetching source code of webpage System.out.println("test case passed"); } }

No comments:

Post a Comment