Skip to content

Commit

Permalink
fuck u github ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kaixinol committed Nov 13, 2023
1 parent 17d4416 commit 986be65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
27 changes: 6 additions & 21 deletions tests/CI.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
from time import sleep

from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver
Expand All @@ -21,27 +22,11 @@ def get_browser() -> WebDriver:
class TestCase(unittest.TestCase):
def test_spider(self):
browser = get_browser()
tweet = Tweet('https://twitter.com/_CASTSTATION/status/1697029186777706544', is_ci_test=True)
try:
tweet.load_data(browser)
except:
element = browser.find_element(By.XPATH,"//*[contains(text(), '{}')]".format('miku miku oo ee oo'))
element_xpath = browser.execute_script(
"function getElementXPath(element) {"
" if (element && element.id) {"
" return 'id(\"' + element.id + '\")';"
" } else {"
" return getElementXPath(element.parentNode) + '/' + element.tagName.toLowerCase();"
" }"
"}"
"return getElementXPath(arguments[0]);",
element
)

# 输出匹配到的元素的XPath表达式
print("匹配到的元素的XPath表达式:", element_xpath)
browser.save_screenshot('debug.png')
self.assertEqual(True, True)
browser.get('https://twitter.com/_CASTSTATION/status/1697029186777706544')
sleep(20)
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'))


if __name__ == '__main__':
Expand Down
1 change: 0 additions & 1 deletion twitter_user_tweet_crawler/tweet.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def click_sensitive_element():
result = None
available_driver.get(self.link)
wait = WebDriverWait(available_driver, 20)
sleep(60)
element = wait.until(EC.presence_of_element_located((By.XPATH, '//*/time/ancestor::*[3]')))
time_stamp = element.find_element(By.XPATH, '//time').get_attribute('datetime')
location = True
Expand Down

0 comments on commit 986be65

Please sign in to comment.