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 12, 2023
1 parent 5c7db9a commit 918a9c4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/CI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.by import By

from twitter_user_tweet_crawler.tweet import Tweet

Expand All @@ -24,8 +25,23 @@ def test_spider(self):
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('miku miku oo ee oo',tweet.text)
self.assertEqual(True, True)


if __name__ == '__main__':
Expand Down

0 comments on commit 918a9c4

Please sign in to comment.