Update example tests
This commit is contained in:
parent
f60ab9dd46
commit
a139f3b3dc
|
@ -1,7 +1,5 @@
|
|||
"""
|
||||
This test demonstrates the use of the "rate_limited" decorator.
|
||||
You can use this decorator on any method to rate-limit it.
|
||||
"""
|
||||
""" This test demonstrates the use of the "rate_limited" decorator.
|
||||
You can use this decorator on any method to rate-limit it. """
|
||||
|
||||
from seleniumbase import BaseCase
|
||||
from seleniumbase import decorators
|
||||
|
|
|
@ -4,11 +4,12 @@ from seleniumbase import BaseCase
|
|||
|
||||
class ChinesePdfTests(BaseCase):
|
||||
def test_chinese_pdf(self):
|
||||
self.open("data:,")
|
||||
pdf = "https://seleniumbase.io/cdn/pdf/unittest_zh.pdf"
|
||||
|
||||
# Get and print PDF text
|
||||
pdf_text = self.get_pdf_text(pdf, page=2)
|
||||
print("\n" + pdf_text)
|
||||
self._print("\n" + pdf_text)
|
||||
|
||||
# Assert PDF contains the expected text on Page 2
|
||||
self.assert_pdf_text(pdf, "个测试类", page=2)
|
||||
|
|
|
@ -3,9 +3,10 @@ from seleniumbase import BaseCase
|
|||
|
||||
class PdfTests(BaseCase):
|
||||
def test_get_pdf_text(self):
|
||||
self.open("data:,")
|
||||
pdf = (
|
||||
"https://nostarch.com/download/"
|
||||
"Automate_the_Boring_Stuff_sample_ch17.pdf"
|
||||
)
|
||||
pdf_text = self.get_pdf_text(pdf, page=1)
|
||||
print("\n" + pdf_text)
|
||||
self._print("\n" + pdf_text)
|
||||
|
|
|
@ -3,6 +3,7 @@ from seleniumbase import BaseCase
|
|||
|
||||
class PdfAssertTests(BaseCase):
|
||||
def test_assert_pdf_text(self):
|
||||
self.open("data:,")
|
||||
# Assert PDF contains the expected text on Page 1
|
||||
self.assert_pdf_text(
|
||||
"https://nostarch.com/download/Automate_the_Boring_Stuff_dTOC.pdf",
|
||||
|
|
|
@ -7,14 +7,20 @@ class ScrapeBingTests(BaseCase):
|
|||
self.wait_for_element("main h2 a")
|
||||
soup = self.get_beautiful_soup()
|
||||
titles = [item.text for item in soup.select("main h2 a")]
|
||||
print("\nSearch Result Headers:")
|
||||
self._print("\nSearch Result Headers:")
|
||||
for title in titles:
|
||||
if "seleniumbase/" in title.lower():
|
||||
print(" " + title)
|
||||
if (
|
||||
"seleniumbase/" in title.lower()
|
||||
or "SeleniumBase Docs" in title
|
||||
):
|
||||
self._print(" " + title)
|
||||
links = [item["href"] for item in soup.select("main h2 a")]
|
||||
print("Search Result Links:")
|
||||
self._print("Search Result Links:")
|
||||
for link in links:
|
||||
if "github.com/seleniumbase" in link.lower():
|
||||
print(" " + link)
|
||||
if (
|
||||
"github.com/seleniumbase" in link.lower()
|
||||
or "https://seleniumbase.io/" in link.lower()
|
||||
):
|
||||
self._print(" " + link)
|
||||
self.click_if_visible('a[href="https://github.com/seleniumbase"]')
|
||||
print("Last Page = " + self.get_current_url())
|
||||
self._print("Last Page = " + self.get_current_url())
|
||||
|
|
Loading…
Reference in New Issue