Tuesday, 6 December 2016

How to launch safari browser in selenium webdriver



Please follow belows steps for launching safari browser in selenium webdriver


We need to install safari driver extension in safari browser. please follow the below steps for launch safari browser.

1) Go to http://docs.seleniumhq.org/download/

2) Scroll down -> Go to the section "SafariDriver" and download "SafariDriver.safariextz"

3) Double click on "SafariDriver.safariextz" (previously downloaded)

4) Safari would open with a pop up containing "Install" button -> Click Install button

5) Now go to Preferences of Safari and you would see WebDriver (in my case WebDriver 2.48.0) is installed (Enable WebDriver checkbox is checked))

6) It's now time to instantiate SafariDriver and get the desired URL by using Java code:

WebDriver driver = new SafariDriver();
driver.get("https://www.google.com");




Error :

If we are not install SafariDriver.safariextz extension in safari browser, we will get the below error in safari browser during the automation

"Unable to establish a connection with the SafariDriver Extension"


Solution : Follow the above steps to get install "SafariDriver.safariextz" extension in safari browser.



Exception :


If we are not install SafariDriver.safariextz extension in safari browser, we will get the below exception in console during the automation

Driver instantiation Exception Remote Client is not accessible



Solution : Follow the above steps to get install "SafariDriver.safariextz" extension in safari browser.

No comments:

Post a Comment