Wednesday, 9 November 2016

Get commands in selenium


Today we will be discussing Get commands.Lets start

1. get()          -               It automatically open a new browser window and fetches the page
                                      or Url that is entered inside parentheses.
                                      Ex-   driver.get("any site name")

2. getTitle()   -              It fetches the title of the current page.
                                      Ex-  driver.get("any site name");
                                      String s= driver.getTitle();
                                      System.out.println(s);       // It will show the title of the website

3. getPageSource()  -    It returns the source code of the page as a String
                                      Ex- driver.getPageSource();

4. getCurrentUrl()   -    It gets the url of the current page which is displayed in browser

5. getText()             -    It fetches the inner text of the specified element.