How to Launch Apple Safari browser?

How to Launch Apple Safari browser?

Apple Safari

SafariDriver comes bundled with the Selenium server’s package, thus user is not required to download or set any external entity. It is readily available to execute the test scripts on Safari. Thus, user can directly launch the Safari Browser similar to that of Mozilla Firefox.

Example:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.safari.SafariDriver;
public class SafariDriverTest {

   public static void main(String[] args) {

       // Create webDriver reference
       WebDriver driver;
       // Launch SafariDriver
       driver = new SafariDriver();
       // Open the web page
       driver.get("http://google.com");
       // Enter the text in the search box
       WebElement searchText = driver.findElement(By.name("q"));
       searchText.sendKeys("SafariDriver");
       // Close the driver
       driver.quit();
   }
}

 

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site.
I welcome and value your comments, suggestions and corrections.

216total visits,2visits today

The only business I know is learning new technology and spreading the knowledge. I believe sharing is learning. This is my prime reason to build this site. I welcome and value your comments, suggestions and corrections.