0% found this document useful (0 votes)
2 views3 pages

Day 2 Introducton of Method

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Day 2 Introducton of Method

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Introduction of locators

WebDriver Interface Methods:-


1. get():-
Syntax:- object.get("url");
Website:- google.com For Example:-
driver.get(“https://www.google.com/”);
2. getTitle():-
Syntax:- String title=object.getTitle();
System.out.println(title);
Website:- google.com For
Example:- String title=driver.getTitle();
System.out.println("Title of the Current Page is: "+title);
3. getCurrentUrl():-
Syntax:- String url=object.getCurrentUrl();
System.out.println(url);
Website:- facebook.com
For Example:- String url=driver.getCurrentUrl();
System.out.println("URL of the Current Page is: "+url);
4. getPageSource():-
Syntax:- String ps=object.getPageSource(); System.out.println(ps);
Website:- facebook.com
For Example:- String url=driver.getPageSource();
System.out.println(" Page Source is: "+ps);1
5. findElement():- Syntax:- object.findElement(locator);
Website:- Demo Web Shop
For Example:- for first name
WebElement us=driver.findElement(By.xpath("//input[@id=
'FirstName']")).sendKe ys("Surbhi");
6. findElements():-
Syntax:- List ls=driver.findElements();
7. manage():-
Syntax:- object.manage().window().maximize();
Website:- google.com
For Example:- driver.manage().window().maximize();
8. switchTo():-
Syntax:- object.switchTo().window();
Website:- google.com For Example:- driver.switchTo().frame(0);
9. manage.getCookies():-
Syntax:- Set cookie=driver.manage.getCookies();2
10. navigate().to():-
Syntax:- driver.navigate().to(“url”);
Website:-facebook.com
For Example:- driver.navigate().to("https://www.facebook.com/");
11. getWindowHandle():-
Syntax:- String abc=driver.getWindowHandle();
12. getWindowHandles():-
Syntax:- Set keys=driver.getWindowHandles();
13. manage().deleteAllCookies():-
Syntax:- driver.manage().deleteAllCookies();
14. close():-
Syntax:- driver.close();
15. quit():-
Syntax:- driver.quit();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy