use of com.testsigma.automator.entity.OsBrowserType in project testsigma by testsigmahq.
the class LinuxBrowsers method getBrowserList.
public ArrayList<AgentBrowser> getBrowserList() {
ArrayList<AgentBrowser> browserList = new ArrayList<>();
for (OsBrowserType browserType : browsersMap.keySet()) {
String browserName = browsersMap.get(browserType);
ArrayList<String> arrayList = getCommandOutput(new String[] { "which", browserName });
if (arrayList.size() > 0) {
if (!arrayList.get(0).contains("which: no " + browserName + " in")) {
String version = "";
ArrayList<String> versionOutput;
log.debug("Fetching browser version for " + browserType.name() + " with ordinal: " + browserType.getValue());
switch(browserType.getValue()) {
case 1:
log.debug("Fetching linux browsers version....chrome version");
versionOutput = getCommandOutput(new String[] { arrayList.get(0), "--product-version" });
version = versionOutput.get(0);
break;
case 2:
log.debug("Fetching linux browsers version....firefox version");
versionOutput = getCommandOutput(new String[] { arrayList.get(0), "-v" });
Pattern pattern = Pattern.compile("^[\\D\\s]*([0-9.]+)[\\D\\s]*$");
Matcher matcher = pattern.matcher(versionOutput.get(0));
if (matcher.find()) {
version = matcher.group(1);
}
break;
}
log.debug("Found version - " + version);
try {
browserList.add(new AgentBrowser(browserType, version, 0));
} catch (Exception e) {
log.info("Ignoring browser because of bellow error");
log.error(e, e);
}
}
}
}
return browserList;
}
use of com.testsigma.automator.entity.OsBrowserType in project testsigma by testsigmahq.
the class DeviceContainer method syncBrowserDrivers.
public void syncBrowserDrivers(MobileDevice mobileDevice) {
log.info("Syncing Browser Drivers For Mobile Devices - " + mobileDevice);
List<AgentBrowser> browserList = mobileDevice.getBrowserList();
if (browserList == null) {
return;
}
for (AgentBrowser browserObj : browserList) {
try {
log.info("Trying to sync driver for mobile browser - " + browserObj);
OsBrowserType browserType = browserObj.getName();
String browserVersion = browserObj.getMajorVersion() + "";
Browsers browser = OsBrowserType.getBrowserType(browserType);
String driverPath = AutomatorConfig.getInstance().getAppBridge().getDriverExecutablePath(browser.getKey(), browserVersion);
new DriversUpdateService().syncBrowserDriver(browserType, browserVersion, driverPath);
} catch (AutomatorException e) {
log.error(e.getMessage(), e);
}
}
}
Aggregations