コード例 #1
0
        public void TestMainCategorEmpty()
        {
            MainCategory testMainCategory = new MainCategory();

            Assert.That(testMainCategory.BaseURL, Is.EqualTo("https://www.olx.pl/"));

            Assert.That(testMainCategory.MainCategoryName, Is.EqualTo(null));
            Assert.That(testMainCategory.MainCategoryURL, Is.EqualTo(null));
        }
コード例 #2
0
        public void TestMainCategoryNonEmpty(string productCategory)
        {
            MainCategory testMainCategory = new MainCategory(productCategory);

            Assert.That(testMainCategory.BaseURL, Is.EqualTo("https://www.olx.pl/"));

            Assert.That(testMainCategory.MainCategoryName, Is.EqualTo(productCategory));
            Assert.That(testMainCategory.MainCategoryURL, Is.EqualTo("https://www.olx.pl/" + productCategory.Replace(" i ", "-").Replace(" ", "-").ToLower() + "/"));
        }
コード例 #3
0
        public OLXProduct(IWebDriver driver, int productNumber)
        {
            List <IWebElement> listOfProducts = new List <IWebElement>(driver.FindElement(By.Id("offers_table")).FindElements(By.ClassName("wrap")));

            if (listOfProducts[productNumber] != null)
            {
                productURL  = listOfProducts[productNumber].FindElement(By.XPath(xpathURL)).GetAttribute("href");
                productName = listOfProducts[productNumber].FindElement(By.XPath(xpathName)).Text;

                productDate         = new Date(listOfProducts[productNumber].FindElement(By.XPath(xpathDate)).Text);
                productLocalization = new Location(listOfProducts[productNumber].FindElement(By.XPath(xpathLocalization)).Text);
                productPrice        = new Price(listOfProducts[productNumber].FindElement(By.XPath(xpathPrice)).Text);
                productCategory     = new MainCategory(listOfProducts[productNumber].FindElement(By.XPath(xpathCategory)).Text);
            }
        }