From 0a3e288ab0e824b5d202abd4aaf12039f579d8e3 Mon Sep 17 00:00:00 2001 From: kaesinol Date: Mon, 20 Nov 2023 16:38:12 +0800 Subject: [PATCH] :construction_worker: Update chromedriver acquisition method --- tests/CI.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/CI.py b/tests/CI.py index 6a3c864..eb3bc6a 100644 --- a/tests/CI.py +++ b/tests/CI.py @@ -1,10 +1,19 @@ +import os import unittest from time import sleep from selenium import webdriver from selenium.webdriver.chrome.webdriver import WebDriver from selenium.webdriver.common.by import By - +from twitter_user_tweet_crawler.util.config import config + +print(os.getcwd()) +config.load({"proxy": {"http": "socks5://127.0.0.1:7890", "https": "socks5://127.0.0.1:7890"}, "max_threads": 2, + "header": {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, " + "like Gecko) "} + , "inject_js": "/media/Data/Project/twitter_user_tweet_crawler/script.js", + "save": "/media/Data/Project/twitter_user_tweet_crawler/output/", } + ) from twitter_user_tweet_crawler.tweet import Tweet @@ -24,9 +33,9 @@ def test_spider(self): browser = get_browser() browser.get('https://twitter.com/_CASTSTATION/status/1697029186777706544') sleep(20) - element = browser.find_element(By.XPATH,"//*[contains(text(), '{}')]".format('miku miku oo ee oo')) + element = browser.find_element(By.XPATH, "//*[contains(text(), '{}')]".format('miku miku oo ee oo')) browser.save_screenshot('debug.png') - self.assertIn('miku miku oo ee oo',element.get_attribute('innerHTML')) + self.assertIn('miku miku oo ee oo', element.get_attribute('innerHTML')) if __name__ == '__main__':