Run tests on safari | safari driver using selenium webdriver


import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;

public class SafariTest {

private WebDriver driver = null;

@Test
public void myTest() throws IOException, InterruptedException {
driver.get("http://www.google.com");

}

// Get the platform details
private static boolean isSupportedPlatform() {
Platform current = Platform.getCurrent();
return Platform.MAC.is(current) || Platform.WINDOWS.is(current);
}

@Before
public void createDriver() {
assert (isSupportedPlatform());
// if you want to add safari options use below method
//SafariOptions options = new SafariOptions();
// Add an extra extension
//options.addExtensions(new File("C:\\Program Files\\Safari\\Safari.exe"));

driver = new SafariDriver();
}
}

No images available.