document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package sample;
  2.  
  3. import java.util.concurrent.TimeUnit;
  4.  
  5. import org.openqa.selenium.By;
  6. import org.openqa.selenium.WebDriver;
  7. import org.openqa.selenium.safari.SafariDriver;
  8. import org.testng.annotations.AfterClass;
  9. import org.testng.annotations.BeforeClass;
  10. import org.testng.annotations.Test;
  11.  
  12. public class Safari_Test {
  13.     public WebDriver driver;
  14.  
  15.     @Test
  16.     public void testSafari_Test() throws Exception {
  17.         driver.get("http://www.yelp.com/san-jose");
  18.         driver.findElement(By.className("pseudo-input_text")).click();
  19.         driver.findElement(By.xpath("//li[@data-suggestion=\'Restaurants\']/strong")).click();
  20.         driver.findElement(By.id("header-search-submit")).click();
  21.         driver.findElement(By.id("find_desc")).sendKeys(" Pizza");
  22.         driver.findElement(By.id("header-search-submit")).click();
  23.  
  24.         Thread.sleep(2000);
  25.  
  26.     }
  27.  
  28.     @BeforeClass
  29.     public void beforeClass() {
  30.         //launch safari browser
  31.         driver = new SafariDriver();
  32.         driver.manage().window().maximize();
  33.         driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
  34.     }
  35.  
  36.     @AfterClass
  37.  
  38.     public void afterClass() throws Exception {
  39.         driver.quit();
  40.     }
  41.  
  42. }
');