コード例 #1
0
ファイル: Session.cs プロジェクト: qakit/WinDriver
 public Session(LaunchSession launchSession) : base(launchSession.ImplicitWaitTimeout)
 {
     LaunchSession = launchSession;
     SessionId     = Guid.NewGuid();
     Elements      = new Dictionary <Guid, AutomationElement>();
     Console.WriteLine($"Session with id {SessionId} created!");
 }
コード例 #2
0
        public Guid CreateNewSession(LaunchSession launchSession)
        {
            var session = new Session(launchSession);

            SessionStore.Add(session);

            session.StartApplication();
            return(session.SessionId);
        }
コード例 #3
0
        private void InputCommandExecute(object obj)
        {
            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var launchPickerSession = LoadEventArgs.GetValue <LaunchSession>(loadEventArg);
                inputPickerSession      = launchPickerSession;
            },
                serviceCommandError =>
            {
            }
                           );

            externalInputControl.LaunchInputPicker(listener);
        }
コード例 #4
0
ファイル: WebHelper.cs プロジェクト: qakit/WinDriver
        /// <summary>
        /// Send request which initialize new session
        /// </summary>
        /// <param name="driver"></param>
        /// <returns></returns>
        internal static string StartSession(WinDriver driver)
        {
            using (var httpClient = new HttpClient())
            {
                var launchSession = new LaunchSession
                {
                    App = driver.Options.App,
                    AppStartUpTimeOut   = driver.Options.AppStartUpTimeOut,
                    ImplicitWaitTimeout = driver.Options.ImplicitWaitTimeout
                };

                var json = JsonConvert.SerializeObject(launchSession);
                var data = new StringContent(json, Encoding.UTF8, "application/json");

                var responseMessage = httpClient.PostAsync($"{driver.Uri}/session", data).Result;
                var result          = responseMessage.Content.ReadAsStringAsync().Result;
                return(result.Replace("\"", string.Empty));
            }
        }
        private void GoogleCommandExecute(object obj)
        {
            if (runningAppSession != null)
            {
                runningAppSession.Close(null);
                runningAppSession = null;
            }
            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var session = LoadEventArgs.GetValue <LaunchSession>(loadEventArg);
                SetRunningAppInfo(session);
            },
                serviceCommandError =>
            {
            }
                           );

            launcher.LaunchBrowser("http://connectsdk.com/", listener);
        }
        private void NetflixCommandExecute(object obj)
        {
            if (runningAppSession != null)
            {
                runningAppSession.Close(null);
                runningAppSession = null;
            }
            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var session = LoadEventArgs.GetValue <LaunchSession>(loadEventArg);
                SetRunningAppInfo(session);
            },
                serviceCommandError =>
            {
            }
                           );

            launcher.LaunchNetflix("70217913", listener);
        }
        private void MyDialAppCommandExecute(object obj)
        {
            if (runningAppSession != null)
            {
                myAppSession.Close(null);
                myAppSession = null;
            }

            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var session  = LoadEventArgs.GetValue <LaunchSession>(loadEventArg);
                myAppSession = session;
            },
                serviceCommandError =>
            {
            }
                           );

            launcher.LaunchApp("Levak", listener);
        }
コード例 #8
0
        private void LauncApp_Click(object sender, RoutedEventArgs e)
        {
            var webostvService = (WebOstvService)model.SelectedDevice.GetServiceByName(WebOstvService.Id);

            var responseListener = new ResponseListener
                                   (
                loadEventArg =>
            {
                var v = loadEventArg as LoadEventArgs;
                if (v != null)
                {
                    applaunchSession = v.Load.GetPayload() as LaunchSession;
                }
            },
                serviceCommandError =>
            {
            }
                                   );

            if (launchSession == null && webostvService != null)
            {
                webostvService.LaunchApp(model.Apps[1].Id, responseListener);
            }
        }
        private void AppStoreCommandExecute(object obj)
        {
            if (appStoreSession != null)
            {
                appStoreSession.Close(null);
                appStoreSession = null;
            }
            var listener = new ResponseListener
                           (
                loadEventArg =>
            {
                var session     = LoadEventArgs.GetValue <LaunchSession>(loadEventArg);
                appStoreSession = session;
            },
                serviceCommandError =>
            {
            }
                           );

            String appId = null;

            if (selectedDevice.GetServiceByName("Netcast TV") != null)
            {
                appId = "125071";
            }
            else if (selectedDevice.GetServiceByName("webOS TV") != null)
            {
                appId = "redbox";
            }
            else if (selectedDevice.GetServiceByName("Roku") != null)
            {
                appId = "13535";
            }

            launcher.LaunchAppStore(appId, listener);
        }
コード例 #10
0
 public string GetInfo(LaunchSession launchSession)
 {
     return("Server running");
 }
 private void SetRunningAppInfo(LaunchSession session)
 {
     runningAppSession = session;
 }