Here is simple protractor conf file,
exports.config = {
// The address of a running selenium server.
'seleniumAddress': 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
'capabilities': {
'browserName': 'chrome'
},
// Options to be passed to Jasmine-node.
'jasmineNodeOpts': {
'showColors': true,
'defaultTimeoutInterval': 30000
}
};
here selenium address is harcoded. But I want to programatically pass different address . Do something like
String URL_TEMPLATE = "https://blabla.com/GoLivePage/ExternalAPIs/" + "getSeleniumGrid.jsp?locale=%s&browser=%s&fabric=%s&teamName=%s"
String URL = String.format(URL_TEMPLATE, "US", "Firefox" , "corp", "<Your Team Name>");
Document doc = Jsoup.connect(URL).timeout(0).get();
String machineName = doc.body().text();
DesiredCapabilities capabilities=new DesiredCapabilities(DesiredCapabilities.firefox());
com.openqa.selenium.Proxy tmpProxy = new Proxy();
tmpProxy.setProxyType(org.openqa.selenium.Proxy.ProxyType.DIRECT);
capabilities.setCapability(CapabilityType.PROXY, tmpProxy);
WebDriver session = null;
try {
session = new RemoteWebDriver(new URL("http://"+machineName+"/wd/hub"), capabilities);
And then I want to reuse this session id something like this How to connect and re-use an already opened browser window in Protractor
In above stackoverflow answer the session id is hardcoded but I want to programmatically add it. Basically if need someone to tell me how to programmatically do stuff in protractor config file. I am new to all UI technologies and also to java script.