-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathraw_pokemon.py
More file actions
41 lines (40 loc) · 1.47 KB
/
raw_pokemon.py
File metadata and controls
41 lines (40 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from seleniumbase import SB
with SB(uc=True, test=True, locale="en", ad_block=True) as sb:
url = "https://www.pokemon.com/us"
sb.activate_cdp_mode(url)
sb.sleep(1.5)
sb.click_if_visible("button#onetrust-accept-btn-handler")
sb.sleep(1.2)
sb.click("a span.icon_pokeball")
sb.sleep(2.5)
sb.click('b:contains("Show Advanced Search")')
sb.sleep(2.5)
sb.click('span[data-type="type"][data-value="electric"]')
sb.sleep(0.7)
sb.scroll_into_view("a#advSearch")
sb.sleep(0.7)
sb.click("a#advSearch")
sb.sleep(1.2)
sb.click('img[src*="img/pokedex/detail/025.png"]')
sb.assert_text("Pikachu", 'div[class*="title"]')
sb.assert_element('img[alt="Pikachu"]')
sb.scroll_into_view("div.pokemon-ability-info")
sb.sleep(1.2)
sb.cdp.flash('div[class*="title"]')
sb.cdp.flash('img[alt="Pikachu"]')
sb.cdp.flash("div.pokemon-ability-info")
name = sb.get_text("label.styled-select")
info = sb.get_text("div.version-descriptions p.active")
print("*** %s: ***\n* %s" % (name, info))
sb.sleep(2)
sb.cdp.highlight_overlay("div.pokemon-ability-info")
sb.sleep(2)
sb.open("https://events.pokemon.com/EventLocator/")
sb.sleep(2)
sb.click('span:contains("Championship")')
sb.sleep(2)
events = sb.select_all("div.event-info__title")
print("*** Pokémon Championship Events: ***")
for event in events:
print("* " + event.text)
sb.sleep(2)