MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / test_scrape_bing

Method test_scrape_bing

examples/test_scrape_bing.py:6–31  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4
5class ScrapeBingTests(BaseCase):
6 def test_scrape_bing(self):
7 if self._multithreaded:
8 self.goto_if_not_url("about:blank")
9 self.skip("Skipping test in multi-threaded mode.")
10 self.goto("www.bing.com/search?q=SeleniumBase+GitHub&qs=n&form=QBRE")
11 self.wait_for_element("main h2 a")
12 self.sleep(0.5)
13 soup = self.get_beautiful_soup()
14 titles = [item.text for item in soup.select("main h2 a")]
15 print("\nSearch Result Headers:")
16 for title in titles:
17 if (
18 "seleniumbase/" in title.lower()
19 or "SeleniumBase Docs" in title
20 ):
21 print(" " + title)
22 links = [item["href"] for item in soup.select("main h2 a")]
23 print("Search Result Links:")
24 for link in links:
25 if (
26 "github.com/seleniumbase" in link.lower()
27 or "https://seleniumbase.io/" in link.lower()
28 ):
29 print(" " + link)
30 self.click_if_visible('a[href="https://github.com/seleniumbase"]')
31 print("Last Page = " + self.get_current_url())

Callers

nothing calls this directly

Calls 9

skipMethod · 0.80
goto_if_not_urlMethod · 0.45
gotoMethod · 0.45
wait_for_elementMethod · 0.45
sleepMethod · 0.45
get_beautiful_soupMethod · 0.45
selectMethod · 0.45
click_if_visibleMethod · 0.45
get_current_urlMethod · 0.45

Tested by

no test coverage detected