Wednesday, 12 February 2020

macOS - selenium with chrome browser




download chromedriver.exe and run below code - rest all same as windows


@org.testng.annotations.Test
public void m2() {
System.setProperty("webdriver.chrome.driver",
"/Users/kk/Documents/workspace/test/driver/chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("http://www.facebook.com");

}

macOS - Safari browser : selenium setup

Install Java
Install Eclipse
Install TestNg
Create Maven project - add selenium-java & TestNG dependencies

1. Open Safari Browser and look out for Develop Menu
     if you do not found Develop menu , you had to enable it by following below step
     Safari->Preferences -> Advanced Tab -> Select 'Show Develop menu in menu bar'
2. Develop menu -> Allow Remote Automation

Thats all - Here is the Program for safari'

        @Test
public void m1(){
System.out.println("test");
WebDriver driver = new SafariDriver();
driver.get("http://www.facebook.com");

}

Run it

To summarise, we do not need any driver.exe file needs to be downloaded
and configured!