티스토리 뷰

SWDesk

[Python] Beautifulsoup Example

inhae 2022. 6. 29. 18:39

 

def Test_ElemText():
    from ChromeAccess import cChromeAccess

    chrome1 = cChromeAccess()
    webDriver = chrome1.GetWebDriver()
    webDriver.get("https://lumena.co.kr/category/fan/61/")

    param1 = {
        'TagType': "html",
        'TagValue': "a"
    }
    elems1 = chrome1.GetElements(webDriver, param1)
    for elem1 in elems1:
        text1 = elem1.text
        if not text1:
            print("[text1] = None")
        text2_ = elem1.get_attribute('textContent')
        text2 = text2_
        link1 = elem1.get_attribute('href')
        print("[text-", len(text1), "]", text1)
        print("[text2]", text2)
        print("[link]", link1)
반응형
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
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
글 보관함