public void CreateAndroidDriverInGridWithWebAppByDefaultPasses()
        {
            System.Console.WriteLine($"Thread # [{System.Threading.Thread.CurrentThread.ManagedThreadId}]");
            //Check if this is true for IOSdriver
            AndroidDriver <AppiumWebElement> driver = MobileDriver.Get <AndroidDriver <AppiumWebElement> >();
            // TestLogs.WriteDeviceLogs();
            ServerCommandExecutor executor = new ServerCommandExecutor(this.GetParameters().ServerUri, driver.SessionId);

            Console.WriteLine($"Current device orientation is:{driver.Orientation}");
            executor.Execute("setOrientation", new Dictionary <string, object> {
                { "orientation", "LANDSCAPE" }
            });
            Console.WriteLine($"New device orientation is: {driver.Orientation}");
            TestContext.WriteLine($"Web app SessionId is:[{driver.SessionId}]");
            Assert.NotNull(driver, $"driver cannot be null");
            /*System.Console.WriteLine($"Server running test [{driver.PlatformName}]");*/
            driver.Navigate().GoToUrl("http://google.com");
            System.Console.WriteLine($"Curretn activity:{driver.CurrentActivity}");

            Wait.ForPageToLoad();
            AppiumWebElement searchTextControl = driver.FindElement(By.CssSelector("div.SDkEP input.gLFyf"), 10);

            searchTextControl.Click();
            searchTextControl.SendKeys("Hello there@@");
            Wait.Seconds(3);
            Assert.AreEqual(driver.Contexts.Count, 2, "Multiple Contexts");
            Assert.AreEqual(driver.Context.ToString(), "CHROMIUM", "Expected Chromium context");
            OpenQA.Selenium.Remote.Response result1 = executor.Execute("getAvailableLogTypes");
            Console.WriteLine($"Supported Log Types:\n {result1.ToJson()}");
        }
Пример #2
0
    Execute(string driverCommandToExecute, System.Collections.Generic.Dictionary <string, object> parameters)
    {
        if (driverCommandToExecute == OpenQA.Selenium.Remote.DriverCommand.NewSession)
        {
            var resp = new OpenQA.Selenium.Remote.Response();
            resp.Status    = OpenQA.Selenium.WebDriverResult.Success;
            resp.SessionId = this._sessionId;
            resp.Value     = new System.Collections.Generic.Dictionary <String, Object>();
            return(resp);
        }
        var respBase = base.Execute(driverCommandToExecute, parameters);

        return(respBase);
    }