0% found this document useful (1 vote)
851 views5 pages

Selenium WebDriver Script Examples

The document provides examples of Selenium WebDriver scripts for common tasks like opening a URL, getting the page title and URL, getting page source, closing the browser window, maximizing the browser window, and getting label text. It demonstrates how to use various Selenium WebDriver methods like get(), getTitle(), getCurrentUrl(), getPageSource(), close(), manage().window().maximize(), and findElement().getText(). The document recommends visiting http://funandknowledge.blogspot.in/ for more Selenium WebDriver scripts.

Uploaded by

seleniumuser123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
851 views5 pages

Selenium WebDriver Script Examples

The document provides examples of Selenium WebDriver scripts for common tasks like opening a URL, getting the page title and URL, getting page source, closing the browser window, maximizing the browser window, and getting label text. It demonstrates how to use various Selenium WebDriver methods like get(), getTitle(), getCurrentUrl(), getPageSource(), close(), manage().window().maximize(), and findElement().getText(). The document recommends visiting http://funandknowledge.blogspot.in/ for more Selenium WebDriver scripts.

Uploaded by

seleniumuser123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Introduction
  • Opening a URL
  • Retrieving Page Information
  • Managing Browser Window
  • Interacting with Web Elements

Selenium Webdriver Scripts

[Link]

For more Selenium Webdriver Scripts Visit - [Link]

Selenium Webdriver Scripts 1. get( ) - Selenium WebDriver method to open the specified URL page public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); [Link]("[Link] } } Opens google page [Link]() - Returns The title of the current page public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link]([Link]()); } } Output- QTP Scripts and Selenium Webdriver Scripts
For more Selenium Webdriver Scripts Visit - [Link]

3. getCurrentUrl() - Returns The URL of the page currently loaded in the browser public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link]([Link]()); } }

Output - [Link] 4. getPageSource() - Returns the source code of the page public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link]([Link]()); } }

For more Selenium Webdriver Scripts Visit - [Link]

5. close() - Closes the current window

public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link](); } }

[Link] to Maximize browser window in Selenium Web Driver public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link]().window().maximize(); } }

For more Selenium Webdriver Scripts Visit - [Link]

7. How to get label text or capture label text in Selenium webdriver

public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); [Link]("[Link] [Link]([Link]([Link]("btnK")).g etText()); }

Output- Google Search

For more Selenium Webdriver Scripts Visit - [Link]

For more Selenium Webdriver Scripts  Visit - http://funandknowledge.blogspot.in/  
 
 
 
 
 
 
 
 
 
 
 
Selenium  Webdrive
For more Selenium Webdriver Scripts  Visit - http://funandknowledge.blogspot.in/  
 
 
 
Selenium Webdriver Scripts 
 
 
1.
For more Selenium Webdriver Scripts  Visit - http://funandknowledge.blogspot.in/  
 
 
3. getCurrentUrl() - Returns The URL
For more Selenium Webdriver Scripts  Visit - http://funandknowledge.blogspot.in/  
 
 
 
5. close() - Closes the current wi
For more Selenium Webdriver Scripts  Visit - http://funandknowledge.blogspot.in/  
 
 
 
 
7. How to get label text or capt

You might also like