Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Selenium Webdriver Scripts
http://funandknowledge.blogspot.in/

For more Selenium Webdriver Scripts Visit - http://funandk...
Selenium Webdriver Scripts
1. get( ) - Selenium WebDriver method to open the specified
URL page
public class Sample {
publ...
3. getCurrentUrl() - Returns The URL of the page currently
loaded in the browser
public class Sample {
{

public static vo...
5. close() - Closes the current window

public class Sample {
{

public static void main(String[] args)
WebDriver driver =...
7. How to get label text or capture label text in Selenium
webdriver

public class Sample {
public static void main(String...
Upcoming SlideShare
Loading in …5
×

Selinium webdriver scripts - http://funandknowledge.blogspot.in/

1,062 views

Published on

Selenium Scripts

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

Selinium webdriver scripts - http://funandknowledge.blogspot.in/

  1. 1. Selenium Webdriver Scripts http://funandknowledge.blogspot.in/ For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  2. 2. 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(); driver.get("http://www.funandknowledge.blogspot.com"); } } Opens google page 2.getTitle() - Returns The title of the current page public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); System.out.println(driver.getTitle()); } } Output- QTP Scripts and Selenium Webdriver Scripts For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  3. 3. 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(); driver.get("http://www.funandknowledge.blogspot.com"); System.out.println(driver.getCurrentUrl()); } } Output - http://www.funandknowledge.blogspot.in/ 4. getPageSource() - Returns the source code of the page public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); System.out.println(driver.getPageSource()); } } For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  4. 4. 5. close() - Closes the current window public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); driver.close(); } } 6.How to Maximize browser window in Selenium Web Driver public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); driver.manage().window().maximize(); } } For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  5. 5. 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(); driver.get("http://google.com"); System.out.println(driver.findElement(By.name("btnK")).g etText()); } } Output- Google Search For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/

×