use of com.seleniumtests.util.osutility.ProcessInfo in project seleniumRobot by bhecquet.
the class LocalAppiumLauncher method startAppiumWithWait.
/**
* Start appium and wait for availability
* To work around windows launching, which spawns a new cmd (we cannot stop the underlying node process),
* get the node process PID associated to the newly created appium
*/
public void startAppiumWithWait() {
synchronized (appiumLauncherLock) {
List<ProcessInfo> nodeProcessesInitial = OSUtilityFactory.getInstance().getRunningProcesses("node");
startAppiumWithoutWait();
// wait for startup
waitAppiumAlive();
for (ProcessInfo nodeProcess : OSUtilityFactory.getInstance().getRunningProcesses("node")) {
if (!nodeProcessesInitial.contains(nodeProcess)) {
appiumNodeProcess = nodeProcess;
break;
}
}
}
}
use of com.seleniumtests.util.osutility.ProcessInfo in project seleniumRobot by bhecquet.
the class TestOsUtility method testWhichInternetExplorerWebBrowserRunning.
@Test(groups = { "it" })
public void testWhichInternetExplorerWebBrowserRunning() {
if (OSUtility.isWindows()) {
osUtil.killAllWebBrowserProcess(true);
SeleniumTestsContextManager.getThreadContext().setBrowser("iexplore");
WebUIDriver.getWebDriver(true);
List<ProcessInfo> pis = osUtil.whichWebBrowserRunning();
for (ProcessInfo pi : pis) {
if (pi.getName().contains("iexplore")) {
return;
}
}
Assert.fail("Internet Explorer has not been found");
}
}
use of com.seleniumtests.util.osutility.ProcessInfo in project seleniumRobot by bhecquet.
the class TestOsUtility method testWhichSafariWebBrowserRunning.
@Test(groups = { "it" })
public void testWhichSafariWebBrowserRunning() {
if (OSUtility.isMac()) {
osUtil.killAllWebBrowserProcess(true);
SeleniumTestsContextManager.getThreadContext().setBrowser("safari");
WebUIDriver.getWebDriver(true);
List<ProcessInfo> pis = osUtil.whichWebBrowserRunning();
for (ProcessInfo pi : pis) {
if (pi.getName().contains("safari")) {
return;
}
}
Assert.fail("Safari has not been found");
}
}
use of com.seleniumtests.util.osutility.ProcessInfo in project seleniumRobot by bhecquet.
the class TestOsUtility method testWhichEdgeWebBrowserRunning.
@Test(groups = { "it" })
public void testWhichEdgeWebBrowserRunning() {
if (OSUtility.isWindows10()) {
osUtil.killAllWebBrowserProcess(true);
SeleniumTestsContextManager.getThreadContext().setBrowser("edge");
WebUIDriver.getWebDriver(true);
List<ProcessInfo> pis = osUtil.whichWebBrowserRunning();
for (ProcessInfo pi : pis) {
if (pi.getName().contains("edge")) {
return;
}
}
Assert.fail("Edge has not been found");
}
}
use of com.seleniumtests.util.osutility.ProcessInfo in project seleniumRobot by bhecquet.
the class TestOsUtility method testKillProcess.
@Test(groups = { "it" })
public void testKillProcess() {
if (OSUtility.isWindows()) {
OSCommand.executeCommand("calc");
WaitHelper.waitForSeconds(2);
ProcessInfo pi = osUtil.getRunningProcess("calc");
if (pi == null) {
// Windows 10
pi = osUtil.getRunningProcess("calculator");
}
if (pi == null) {
// Windows 10
pi = osUtil.getRunningProcess("Calculator");
}
if (pi == null) {
// Windows 2016
pi = osUtil.getRunningProcess("win32calc");
}
if (pi == null) {
throw new ConfigurationException("Cannot find process 'calc', 'win32calc' or 'calculator'");
}
osUtil.killProcess(pi.getPid(), true);
Assert.assertNull(osUtil.getRunningProcess("calc"));
Assert.assertNull(osUtil.getRunningProcess("calculator"));
Assert.assertNull(osUtil.getRunningProcess("Calculator"));
Assert.assertNull(osUtil.getRunningProcess("win32calc"));
}
}
Aggregations