-2

I try to find and get element(text), using

enter image description here

elem = driver.find_element(By.XPATH,'//*[@id="t3_9kxrv6"]/div/div/div[3]/span/h2')

If I print it, I get:

<selenium.webdriver.remote.webelement.WebElement (session="2c3430395624712686d8cbfe1824c18e", element="0.06192509533309787-1")>

and I want: "The problems of a dutchman in China."

0

1 Answer 1

2

You want just .text

So, use this

elem = driver.find_element(By.XPATH,'//*[@id="t3_9kxrv6"]/div/div/div[3]/span/h2').text
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.