3

Getting the following exception when trying to run the selenium tests on Mac- Safari using Selenium Grid. I could see the safari browser on Hub console, but when running the tests getting the exception.

System.InvalidOperationException: Failed to connect to SafariDriver after 10357 ms

Safari Extension version : 2.48 and 
Selenium Stand alone server : 2.53

Code:

DesiredCapabilities ds = new DesiredCapabilities();
ds.SetCapability(CapabilityType.BrowserName, "safari");
ds.SetCapability(CapabilityType.Platform, "MAC");

Could anyone help/guide me in resolving the issue

1
  • My first guess would be that the browser name is case sensitive, given that the error message is using "Safari" and not "safari".
    – Kate Paulk
    Apr 11, 2016 at 12:21

1 Answer 1

4
public class Selenium_Grid
{
       WebDriver driver;
       String baseUrl, nodeUrl;

       @BeforeTest
       public void setUp() throws MalformedURLException
       {
           baseUrl = "www.fb.com/";
           nodeUrl = "http://192.168.1.57:6666(port_n0)/wd/hub";
           DesiredCapabilities capibility = DesiredCapabilities.safari();
           capibility.setBrowserName("safari");
           capibility.setPlatform(Platform.MAC);
           driver = new RemoteWebDriver(new URL(nodeUrl), capibility);

       }

       @AfterTest
       public void tearDown()
       {
           driver.quit;
       }

}

Try with this-

Note:

  1. use proper parameters that you have used in your code.
  2. check whether node is successfully connected or not with your Hub.
  3. use different port no of Hub & node.
1
  • @Swapna, Have you tried with this ? Apr 11, 2016 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.