コード例 #1
0
    def test_screenshot(self):
        keywords = random.choice(self.keyword_list)
        config = Config()
        config.set('screenshot', True)
        scrap = SerpScrap()
        scrap.init(config=config.get(), keywords=keywords)
        # results = scrap.run()

        screendir = '{}/{}'.format(config.get()['dir_screenshot'],
                                   config.today)

        assert config.get()['screenshot'] is True
        assert os.path.exists(screendir) is True
コード例 #2
0
    def test_simple(self):

        keywords = random.choice(self.keyword_list)

        config = Config()
        config.set('sel_browser', 'chrome')
        config.set('chrome_headless', True)
        config.set('executable_path', '/usr/local/bin/chromedriver')
        scrap = SerpScrap()
        scrap.init(config=config.get(), keywords=keywords)
        results = scrap.run()

        assert len(results) > 0
        assert len(results[0]) > 0
コード例 #3
0
ファイル: test_basic.py プロジェクト: DrSn2/SerpScrap
    def test_simple(self):

        keyword_list = [
            'computer news',
            'since topics',
            'python tutorial',
            'pythons',
            'machine learning',
            'artificial intelligence',
        ]
        keywords = random.choice(keyword_list)

        config = Config()
        config.set('scrape_urls', False)
        scrap = SerpScrap()
        scrap.init(config=config.get(), keywords=keywords)
        results = scrap.run()

        assert len(config.get()) == 28
        assert len(results) > 0
        assert len(results[0]) > 0