硒按类名称查找元素,返回错误信息

时间:2020-04-01 05:33:40

标签: python selenium web-scraping

尝试在Python中运行

driver.get("myWebite")

element = driver.find_element_by_class_name('artist-name')

print(element)

我期望的答案是“鲍伊”,但返回的是

<selenium.webdriver.remote.webelement.WebElement (session="23123aef156e1f8c358126ba5b6e2974", element="16198427-753f-4293-b9ee-df1826309113")>

1 个答案:

答案 0 :(得分:0)

driver.get("myWebite")

element = driver.find_element_by_class_name('artist-name')

print(element.text)