Exemplo n.º 1
0
        public static void Search3(object input)
        {
            NewOne Results = (NewOne)input;

            Driver driver3 = new Driver();

            driver3.Initialize();
            driver3.Instance.Navigate().GoToUrl("http://www.duckduckgo.com");

            driver3.Instance.FindElement(By.Id("search_form_input_homepage")).SendKeys(Results.SearchParameter + Keys.Enter);

            List <string> ElemList = new List <string>(driver3.Instance.FindElements(By.XPath("//a[@href]")).Select(iw => iw.Text));

            IEnumerable <string> RefinedElemlist = from e in ElemList
                                                   where e.Contains("http")
                                                   select e;

            Results.Dsearch = RefinedElemlist;
        }
Exemplo n.º 2
0
        public static void Search1(object input)
        {
            NewOne Results = (NewOne)input;

            Driver driver1 = new Driver();

            driver1.Initialize();
            driver1.Instance.Navigate().GoToUrl("http://www.google.com");

            driver1.Instance.FindElement(By.Name("q")).SendKeys(Results.SearchParameter + Keys.Enter);

            List <string> ElemList = new List <string>(driver1.Instance.FindElements(By.XPath("//a[@href]")).Select(iw => iw.Text).ToList());

            IEnumerable <string> RefinedElemlist = from e in ElemList
                                                   where e.Contains("https")
                                                   select e;

            Results.Gsearch = RefinedElemlist;
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("What searches would you like to compare?");
            string userresponse = Console.ReadLine();

            userresponse = Convert.ToString(userresponse);

            NewOne Results = new NewOne
            {
                Gsearch         = null,
                Bsearch         = null,
                Dsearch         = null,
                SearchParameter = userresponse,
                SearchCalcValue = 1
            };

            Thread thread1 = new Thread(Search1);
            Thread thread2 = new Thread(Search2);
            Thread thread3 = new Thread(Search3);

            thread1.Start(Results);
            thread2.Start(Results);
            thread3.Start(Results);

            thread1.Join();
            thread2.Join();
            thread3.Join();

            Console.WriteLine(Results.Dsearch); // currently used to check if string lists are populated
            Console.WriteLine(Results.Gsearch);
            Console.WriteLine(Results.Bsearch);

            //CompareCalc(Results.Gsearch, Results.Bsearch, Results.Dsearch);           // will soon return a number correlating to
            //Console.WriteLine("The realatedness of your search is" + CompareCalc);    // comparedness once the method is done

            string[]             Test  = new string[300]; // currently used to check if string lists are populated
            IEnumerable <string> Test2 = Results.Gsearch;
            int i = 1;

            foreach (string element in Test2)
            {
                Test[i] = element;
                Console.WriteLine("heres duck" + element);
                i++;
            }

            string[]             Test3 = new string[300]; // currently used to check if string lists are populated
            IEnumerable <string> Test4 = Results.Gsearch;
            int j = 1;

            foreach (string element in Test4)
            {
                Test[j] = element;
                Console.WriteLine("heres google" + element);
                j++;
            }

            string[]             Test5 = new string[300]; // currently used to check if string lists are populated
            IEnumerable <string> Test6 = Results.Gsearch;
            int r = 1;

            foreach (string element in Test6)
            {
                Test[r] = element;
                Console.WriteLine("heres bing" + element);
                r++;
            }
        }