Ejemplo n.º 1
0
def test_find_in_ahref_internal():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_string = "Python 3.8.6 is now available"
    internal_links = page.find_in_ahref(search_string, external=False)
    all_links = page.find_in_ahref(search_string)
    check.is_true(all_links)
    check.equal(len(internal_links), 0)
Ejemplo n.º 2
0
def test_find_in_ahref_fuzzy():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_string = "donate"
    links = page.find_in_ahref(search_string, fuzzy_score=90)
    print(links)
    assert (
        str(links[0])
        == "https://psfmember.org/civicrm/contribute/transact?reset=1&id=2"
    )
Ejemplo n.º 3
0
def test_find_in_ahref_text():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_string = "documentation"
    links = page.find_in_ahref(search_string, in_path=False)
    assert links[0].href == "/doc/"
Ejemplo n.º 4
0
def test_find_in_ahref_path():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_string = "doc"
    links = page.find_in_ahref(search_string, in_text=False, internal=True)
    assert links[0].text.lower() == "documentation"
Ejemplo n.º 5
0
def test_find_in_ahref_internal_searchlist():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_list = ["donate", "facebook"]
    links = page.find_in_ahref(search_list)
    print(links)
    assert len(links) == 2
Ejemplo n.º 6
0
def test_find_in_ahref():
    page = BasePage(TEST_HTML_PAGE, TEST_HTML_URL)
    search_string = "learn more"
    first_found = page.find_in_ahref(search_string)[0]
    assert first_found.href == "/doc/"