Exemple #1
0
        private ScAddress FindElementAddress(Identifier identifier)
        {
            ScAddress scaddress      = ScAddress.Unknown;
            var       cmdFindElement = new FindElementCommand(identifier);
            var       rspFindElement = (FindElementResponse)client.Send(cmdFindElement);

            if (rspFindElement.Header.ReturnCode == ReturnCode.Successfull)
            {
                scaddress = rspFindElement.FoundAddress;
            }
            return(scaddress);
        }
        /// <summary>
        /// Получение адреса произвольного узла базы знаний.
        /// </summary>
        /// <param name="identifier">идентификатор</param>
        /// <returns>SC-адрес узла <see cref="ScAddress"/></returns>
        public ScAddress GetNodeAddress(Identifier identifier)
        {
            ScAddress address = ScAddress.Invalid;

            if (knowledgeBase.IsAvaible)
            {
                var command  = new FindElementCommand(identifier);
                var response = (FindElementResponse)knowledgeBase.ExecuteCommand(command);
                address = response.FoundAddress;
            }
            return(address);
        }
        public async Task <JToken> FindElementNotWait(string strategy, string expr, string startNode = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            await asyncFirefoxDriver.CheckConnected(cancellationToken).ConfigureAwait(false);

            if (asyncFirefoxDriver.ClientMarionette == null)
            {
                throw new Exception("error: no clientMarionette");
            }
            var comm1 = new FindElementCommand(strategy, expr, startNode);
            await asyncFirefoxDriver.ClientMarionette.SendRequestAsync(comm1, cancellationToken).ConfigureAwait(false);

            if (comm1.Error != null)
            {
                throw new WebBrowserException(comm1.Error);
            }
            return(comm1.Result);
        }
Exemple #4
0
 private ScAddress FindElementAddress(Identifier identifier)
 {
     ScAddress scaddress = ScAddress.Unknown;
     var cmdFindElement = new FindElementCommand(identifier);
     var rspFindElement = (FindElementResponse)client.Send(cmdFindElement);
     if (rspFindElement.Header.ReturnCode == ReturnCode.Successfull)
     {
         scaddress = rspFindElement.FoundAddress;
     }
     return scaddress;
 }