3

I am using Selenium webdriver in Python for a web-scraping project.

The webpage, I am working on has a number of Table entries with the same class name.

<table class="table1 text print">

I am using find_element_by_class_name. However I am getting a error :

*Compound class names not permitted *

Another question:

How to iterate through all the tables having the same css classname ?

Thanks

2 Answers 2

4

You should use find_elements_by_class_name. This will return an iterable object.

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

Comments

1

The error you describe happens when you provide multiple class names rather than a single one. An easy way around this is to get the elements using CSSSelector or XPath. Alternatively, you could use find_elements_by_class_name and provide one class name, then iterate through that list to find the elements that match the additional class names you want to match on as well.

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.