While trying to execute a Selenium test on BrowserStack with the capability 'browserstack.local' as 'true' I am getting the following exception-
org.openqa.selenium.WebDriverException: [browserstack.local] is set to true but local testing through BrowserStack is not connected.
If I remove the capability 'browserstack.local' then the test executes, however, it does not access the private network application. I tried to search other online resources around this exception, however, could not find any details.
URL URLObj = new URL("https://" + USERNAME + ":" + KEY + "@hub-cloud.browserstack.com/wd/hub");
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("device", "iPhone 8 Plus");
caps.setCapability("real_mobile", "true");
caps.setCapability("browserstack.local", "true");
AppiumDriver webDriver = new IOSDriver(URLObj, caps);
The excepted result is that the test should run and the private network application should be accessible. Also, the above exception should not be thrown.