Having the following code:
[TestClass]
public class RepairMobileTests
{
public AppiumDriver driver;
public DesiredCapabilities capabilities;
[TestInitialize]
public void BeforeAll()
{
capabilities = new DesiredCapabilities();
capabilities.SetCapability("device", "Android");
capabilities.SetCapability(CapabilityType.Platform, "WINDOWS");
capabilities.SetCapability(CapabilityType.BrowserName, "Chrome");
capabilities.SetCapability("deviceName", ConfigurationManager.AppSettings["deviceName"]);
capabilities.SetCapability("platformName", ConfigurationManager.AppSettings["platformName"]);
capabilities.SetCapability("platformVersion", ConfigurationManager.AppSettings["platformVersion"]);
capabilities.SetCapability("appPackage", ConfigurationManager.AppSettings["appPackage"]);
capabilities.SetCapability("appActivity", ConfigurationManager.AppSettings["appActivity"]);
capabilities.SetCapability("capability.policy.strict.Window.confirm", "noAccess");
}
[TestCleanup]
public void AfterAll()
{
driver.Quit();
}
[TestMethod]
public void LoginSuccessful()
{
WaitMethods wm = new WaitMethods();
driver = new AndroidDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
string homepage = "http://www.siteundertest.com/";
string username = "user";
string password = "pass";
ProdemandLoginPage pdl = new ProdemandLoginPage();
pdl.openPage(homepage, driver);
//Thread.Sleep(10000);
wm.WaitForAjax(driver);
driver.HideKeyboard(); // here is thrown the error
}
}
Error that is thrown:
Test Name: SearchMenu
Test FullName: RepairMobileTestAutomation.RepairMobileTests.SearchMenu
Test Source: c:\Users\net\Documents\Visual Studio 2013\Projects\RepairMobileTestAutomation\RepairMobileTestAutomation\RepairMobileTests.cs : line 419
Test Outcome: Failed
Test Duration: 0:00:19.5419473
Result Message:
Test method RepairMobileTestAutomation.RepairMobileTests.SearchMenu threw exception:
OpenQA.Selenium.WebDriverException: Unexpected error. unknown command: session/0a3e8c760809af9316358a5afa458541/appium/device/hide_keyboard
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Appium.AppiumDriver.HideKeyboard(String strategy, String key)
at OpenQA.Selenium.Appium.AppiumDriver.HideKeyboard()
at RepairMobileTestAutomation.RepairMobileTests.SearchMenu() in c:\Users\net\Documents\Visual Studio 2013\Projects\RepairMobileTestAutomation\RepairMobileTestAutomation\RepairMobileTests.cs:line 437
Appium logs are here http://pastebin.com/4jdJLnY8 I'm running the tests on real devices but i have multiple problems with Touch, Swipe, lock device, hidekeyboard and other gestures. How can I trigger events like tap or scroll down? Can someone post an example? I'm also trying to rotate the screen but nothing happens. Is there a way to do that? I'm running the tests on Chrome app which is installed on device.