Skip to content

Commit 990d2b0

Browse files
author
Mike Spicer
committed
Functional test code done
1 parent 2c36017 commit 990d2b0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

testfunctionality.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,19 @@
2121
wait = WebDriverWait(driver,15)
2222
df = pd.DataFrame()
2323

24-
for item in range(1):
24+
for item in range(10):
2525
wait.until(EC.visibility_of_element_located((By.TAG_NAME,"body"))).send_keys(Keys.END)
26-
time.sleep(15)
26+
time.sleep(2)
2727
# for author in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#ytd-comment-renderer"))):
2828
# #author.append(comment.text)
2929
# df = df.append({'author': author}, ignore_index=True))
30-
df = pd.concat([pd.DataFrame([author.text], columns=['Author']) for author in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".ytd-comment-renderer")) )], ignore_index=True)
30+
df = pd.concat([pd.DataFrame([author.text], columns=['Author']) for author in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#author-text")) )], ignore_index=True)
3131

32-
df = pd.concat([df([comment.text], columns=['Comment']) for comment in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#content-text")) )], ignore_index=True)
32+
df['AuthorLink'] = [author.get_attribute('href') for author in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#author-text")) )]
33+
34+
df['Comment'] = [comment.text for comment in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#content-text")) )]
3335

3436
# for comment in wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "#content-text"))):
3537
# data.append(comment.text)
3638

37-
df = pd.DataFrame(data, columns=['comment'])
38-
df.head()
39+
print(df.head())

0 commit comments

Comments
 (0)