use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestBrowserInfo method testBrowserInfoInternetExplorer.
@Test(groups = { "it" })
public void testBrowserInfoInternetExplorer() {
if (!SystemUtils.IS_OS_WINDOWS) {
throw new SkipException("This test can only be done on Windows");
}
BrowserInfo browserInfo = new BrowserInfo(BrowserType.INTERNET_EXPLORER, "11", "/some/path", false);
browserInfo.getDriverFileName();
Assert.assertTrue(browserInfo.isDriverFileSearched());
Assert.assertEquals(browserInfo.getDriverFileName(), "IEDriverServer_Win32");
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class TestBrowserInfo method testBrowserInfoLegacyFirefox.
@Test(groups = { "it" })
public void testBrowserInfoLegacyFirefox() {
BrowserInfo browserInfo = new BrowserInfo(BrowserType.FIREFOX, "47.0", "/some/path", false);
browserInfo.getDriverFileName();
Assert.assertTrue(browserInfo.isDriverFileSearched());
// for legacy version, no driver file name should be found
Assert.assertNull(browserInfo.getDriverFileName());
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class AdbWrapper method getInstalledBrowsers.
private List<BrowserInfo> getInstalledBrowsers(String deviceId) {
List<BrowserInfo> browsers = new ArrayList<>();
String reply = OSCommand.executeCommandAndWait(String.format("%s -s %s shell \"pm list packages\"", adbCommand, deviceId));
for (String line : reply.split("\n")) {
if (line.contains("package:com.android.chrome")) {
String chromeVersion = OSCommand.executeCommandAndWait(String.format("%s -s %s shell \"dumpsys package com.android.chrome | grep versionName\"", adbCommand, deviceId));
Matcher versionMatcher = REG_CHROME_VERSION_NAME.matcher(chromeVersion.trim());
if (versionMatcher.matches()) {
browsers.add(new BrowserInfo(BrowserType.CHROME, versionMatcher.group(1), null));
} else {
logger.error(String.format("Cannot parse chrome version %s", chromeVersion));
browsers.add(new BrowserInfo(BrowserType.CHROME, chromeVersion, null));
}
}
if (line.contains("package:com.android.browser")) {
String androidVersion = OSCommand.executeCommandAndWait(String.format("%s -s %s shell \"dumpsys package com.android.browser | grep versionName\"", adbCommand, deviceId));
Matcher versionMatcher = REG_BROWSER_VERSION_NAME.matcher(androidVersion.trim());
if (versionMatcher.matches()) {
browsers.add(new BrowserInfo(BrowserType.BROWSER, versionMatcher.group(1), null));
} else {
logger.error(String.format("Cannot parse android browser version %s", androidVersion));
browsers.add(new BrowserInfo(BrowserType.BROWSER, androidVersion, null));
}
}
}
return browsers;
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class InstrumentsWrapper method parseIosDevices.
/**
* Use 'instruments -s devices' to know which devices are available for test
*/
public List<MobileDevice> parseIosDevices() {
String output = OSCommand.executeCommandAndWait("instruments -s devices");
List<MobileDevice> devList = new ArrayList<>();
for (String line : output.split("\n")) {
line = line.trim();
Matcher matcher = REG_DEVICE.matcher(line);
if (matcher.matches()) {
MobileDevice dev = new MobileDevice(matcher.group(1).trim(), matcher.group(3), "iOS", matcher.group(2), Arrays.asList(new BrowserInfo(BrowserType.SAFARI, "latest", null)));
devList.add(dev);
}
}
return devList;
}
use of com.seleniumtests.browserfactory.BrowserInfo in project seleniumRobot by bhecquet.
the class SeleniumTestsContext method updateInstalledBrowsers.
/**
* If chrome or firefox binary is redefined in parameter, update list of installed browser so
* that it matches those really used
*/
private void updateInstalledBrowsers() {
Map<BrowserType, List<BrowserInfo>> installedBrowsers = OSUtility.getInstalledBrowsersWithVersion(getBetaBrowser());
if (getFirefoxBinPath() != null) {
String version = OSUtility.getFirefoxVersion(getFirefoxBinPath());
installedBrowsers.get(BrowserType.FIREFOX).add(new BrowserInfo(BrowserType.FIREFOX, OSUtility.extractFirefoxVersion(version), getFirefoxBinPath()));
}
if (getChromeBinPath() != null) {
String version = OSUtility.getChromeVersion(getChromeBinPath());
installedBrowsers.get(BrowserType.CHROME).add(new BrowserInfo(BrowserType.CHROME, OSUtility.extractChromeOrChromiumVersion(version), getChromeBinPath()));
}
}
Aggregations