Back to Course
Selenium WebDriver

Verification Commands: Title, Current URL, PageSource, WindowHandle(s), Text, Attributes

Common Verification Methods

String title = driver.getTitle();
String url = driver.getCurrentUrl();
String source = driver.getPageSource();
String handle = driver.getWindowHandle();       // current window's unique ID
Set<String> handles = driver.getWindowHandles(); // all open windows' IDs
String text = element.getText();
String attr = element.getAttribute("value");

Why These Matter

These methods form the basis of most assertions in a Selenium test — confirming the right page loaded, the right text is displayed, or the correct number of browser windows/tabs are open.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course