0

I have the following html:

<span class="campaign-settings-list__targeting__value js-campaign-settings-value">abc</span>

How can I take this element in using WebDriver in Selenium? I have tried:

return WebDriverWait(self.driver, 30, 0.1).until(
            lambda d: d.find_elements_by_css_selector('.campaign-settings-list__targeting__value .js-campaign-settings-value')
        )

But am getting a timeout exception. Thank you.

1 Answer 1

1

This is the selector you need:

.campaign-settings-list__targeting__value.js-campaign-settings-value. 

Note how it does not have a space between the two classes. This can be described as "select elements which posses both classes campaign-settings-list__targeting__value and js-campaign-settings-value."

The selector you specified is this:

.campaign-settings-list__targeting__value .js-campaign-settings-value

This can be described as "select elements twith the class js-campaign-settings-value which are descendants of elements with the class campaign-settings-list__targeting__value."

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

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.