Selenium with Java 4 - How to get browser window title? How to get url? How to get page source?

Опубликовано: 28 Сентябрь 2024
на канале: Ankpro Training
2,903
27

How to get browser window title?
How to get url?
How to get page source?

Selenium - How to get title, url and page source

How to get Page Title
How to get URL
How to get Page Source

How to get Page Title?
getTitle() is a method present in WebDriver Interface.
This getTitle() method gets the title of the current browser window.
Usage : String title = driver.getTitle();

How to get URL?
getCurrentUrl() is a method present in WebDriver Interface.
This method gets the current URL in the browser.
Usage: String url = driver.getCurrentUrl();

How to get Page Source?
getPageSource() is a method present in WebDriver Interface.

This method gets the source of the page loaded by the browser.

Usage: String pageSource = driver.getPageSource();

Possible Interview Questions
Explain how to get page title
Explain how to get url
Explain how to get page source




ankpro
ankpro training
Asp.net MVC
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
C
C++
Components of the .Net framework
Hello World
Literal
Keywords
Variable
Data types
Operators
Branching
Loops
Arrays
Strings
Structures
Enums
Functions