eally-root
eally-root

Reputation: 25

Selenium unusual output in python

I am getting comments from website I tried it already and it worked well but now it gives me unusual output.

Part of my code:

comments = driver.find_elements_by_class_name("comment-text")
time.sleep(1)
print(comments[1])

The output:

<selenium.webdriver.remote.webelement.WebElement (session="bb6ae0409dd8ec8c191f9bd84f79bea7", element="5f5d4a2f-7a93-41fe-9ca5-aa4e7c525792")>

Upvotes: 0

Views: 54

Answers (1)

JeffC
JeffC

Reputation: 25611

You want

print(comments[1].text)

You were printing the element itself which is just some GUID (I think). I'm assuming you want the text contained in the element which means you need .text.

Upvotes: 1

Related Questions