So I'm having trouble here. When I manually start the selendroid server the tests run fine. When I'm starting the server from code it just fails.
The code starts the server, the emulator boots up, it removes the screen lock and after that the test fails with this error "No devices are found. This can happen if the devices are in use or no device screen matches the required capabilities."
Yet the tests work when I manually start the server.
package Utilities;
import java.util.concurrent.TimeUnit;
import io.selendroid.SelendroidCapabilities;
import io.selendroid.SelendroidConfiguration;
import io.selendroid.SelendroidDriver;
import io.selendroid.SelendroidLauncher;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
public class Selendroid {
public static SelendroidLauncher selendroidServer;
public static WebDriver driver;
public static String baseUrl;
public static WebDriverWait wait;
@BeforeSuite
public void startSelendroidServer() throws Exception {
if (selendroidServer != null) {
selendroidServer.stopSelendroid();
}
SelendroidConfiguration config = new SelendroidConfiguration();
config.setSessionTimeoutSeconds(60000);
selendroidServer = new SelendroidLauncher(config);
selendroidServer.launchSelendroid();
baseUrl = "http://kask6iktundubkorras.sayat.me/";
DesiredCapabilities caps = SelendroidCapabilities.android();
driver = new SelendroidDriver(caps);
driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
wait = new WebDriverWait(driver, 60, 100);
}
@AfterSuite
public void stopSelendroidServer() {
if (driver != null) {
driver.quit();
}
if (selendroidServer != null) {
selendroidServer.stopSelendroid();
}
}
}
The same code started working when i switched to the newest selendroid standalone version 0.13, which fixed this.