0

Hi everyone I am very new to selenium, just trying out one scraper for my project. I want to select the text present in that div element which I have marked with red color. I have tried using this:

driver.find_element(
        "/html/body/div[1]/div[2]/div[1]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div"
    )

Please help me out, or suggest me a good tutorial. Thanks a lot :) Please check the picture for more clarification about the page

2 Answers 2

1
driver.find_element_by_xpath(ELEMENT_XPATH).text

Use XPath not Full XPath

Sign up to request clarification or add additional context in comments.

Comments

1

Try to find Relative xpath. The xapth for that element would be:

//div[contains(@class,'valueValue')]
Or
//div[starts-with(@class,'valueValue')]

To extract the text from that element:

data = driver.find_element_by_xpath("//div[contains(@class,'valueValue')]")
value = data.text
# Or
value = data.get_attribute('innerText')

Links to refer - Link1, Link2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.