Exemple #1
0
        public void SelectAgent(string fileName)
        {
            IReadOnlyCollection <IWebElement> agentDetails = Driver.Instance.FindElements(By.CssSelector(".tiles a[class]"));

            agentDetails.ElementAt(0).Click();

            var name        = Driver.Instance.FindElement(By.CssSelector(".bioinfo_personal h1")).Text;
            var nationality = Driver.Instance.FindElement(By.XPath("(//span[@class=\'table_column\'])[1]")).Text;
            var languages   = Driver.Instance.FindElement(By.XPath("(//span[@class=\'table_column\'])[2]")).Text;
            var licenseNo   = Driver.Instance.FindElement(By.XPath("(//span[@class=\'table_column\'])[5]")).Text;

            Driver.Instance.FindElement(By.CssSelector(".tab_bar [data-qs-tab]")).Click();
            var aboutMe = Driver.Instance.FindElement(By.XPath("//div[@data-qs-content=\'tab-about\']")).Text;

            Driver.Instance.FindElement(By.CssSelector(".pane_content [data-qs] span")).Click();
            var phoneNumber    = Driver.Instance.FindElement(By.XPath("//span[contains(@class,\"button_text-value\")]")).Text;
            var companyName    = Driver.Instance.FindElement(By.XPath("//div[@class=\'brokerthumbnail_text\']/p[1]")).Text;
            var experience     = Driver.Instance.FindElement(By.XPath("(//span[@class=\'table_column\'])[6]")).Text;
            var activeListings = Driver.Instance.FindElement(By.XPath("(//span[@class=\'table_column\'])[4]/a")).Text;
            var URL            = Driver.Instance.FindElement(By.XPath("(//a[@target=\'_blank\'])[1]")).GetAttribute("href");
            var result         = new AgentDetails
            {
                Name       = name, Nationality = nationality, Languages = languages, LicenseNo = licenseNo,
                AboutMe    = aboutMe, PhoneNumber = phoneNumber, CompanyName = companyName,
                Experience = experience, NoOfActiveListings = activeListings, LinkedInURL = URL
            };

            FIleOutput.SaveToFile(new [] { result }, fileName);
        }
Exemple #2
0
        public void FetchAndSavePrices(string fileName)
        {
            IReadOnlyCollection <IWebElement> searchResult = Driver.Instance.FindElements(By.CssSelector("#serp ul li[data-property-id]"));

            var result = new List <PropertyDetails>();

            foreach (var propertyPrice in searchResult)
            {
                var listingTitle = propertyPrice.FindElement(By.CssSelector("a[title]")).GetAttribute("title");
                var price        = propertyPrice.FindElement(By.CssSelector("span.price")).GetAttribute("data-val");
                result.Add(new PropertyDetails {
                    ListingTitle = listingTitle, Price = price
                });
            }
            FIleOutput.SaveToFile(result, fileName);
        }