Skip to content

Commit b227714

Browse files
committed
Update the TikTok example
1 parent 3e3aa69 commit b227714

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

examples/cdp_mode/raw_tiktok.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
with SB(uc=True, test=True, guest=True) as sb:
44
url = "https://www.tiktok.com/@startrek?lang=en"
55
sb.activate_cdp_mode(url)
6-
sb.sleep(3)
7-
print(sb.get_text('h2[data-e2e="user-bio"]'))
8-
for i in range(54):
9-
sb.scroll_down(12)
6+
sb.sleep(2.5)
7+
sb.click_if_visible('button[data-close-button="true"]')
8+
print("*** " + sb.get_text('h2[data-e2e="user-bio"]'))
9+
for i in range(33):
10+
sb.scroll_by_y(33)
11+
sb.sleep(0.03)
12+
items = sb.find_elements("picture img")
13+
for i, item in enumerate(items):
14+
print("* %s: %s" % (i, str(item.get_attribute("alt"))))
15+
print("*** %s total items found!" % len(items))
1016
sb.sleep(1)

0 commit comments

Comments
 (0)