(self)
| 4 | |
| 5 | class 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()) |
nothing calls this directly
no test coverage detected