1

I want to extract information from some site. The information that I want to extract is name of Items in list.

Here is example:

<body>
<div class = "_4gt3b">
    <ul class="_539vh _4j13h">
        <li class="_cx1ua">item 1</li>
        <li class="_cx1ua">item 2</li>
        <li class="_cx1ua">item 3</li>
        <li class="_cx1ua">item 4</li>
        <li class="_cx1ua">item 5</li>
    </ul>
</div>

I want extract "item 1,item 2,item 3,..." also I want consider class names "_4gt3b",""_539vh _4j13h","_cx1ua" because It is key to redirect the list of Items.

I use this code:

WebElement = driver.find_elements_by_css_selector("._4gt3b._539vh._cx1ua")

But return:

>>> WebElement
[]

What is problem(s)?

2 Answers 2

1

You need spaces: $('._4gt3b ._539vh ._cx1ua')

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

Comments

1

You can directly get the list of li by using this

elements = driver.find_elements_by_xpath("/li[@class='_cx1ua']")

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.