I am trying to get each of the below elements using
element = driver.findElement(By.className("code-list-item code-list-item-public "));
The output of inspect element is as follows.
<div class="column one-fourth codesearch-aside"></div>
<div class="column three-fourths codesearch-results">
<div class="sort-bar"></div>
<div id="code_search_results">
<div class="code-list">
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
<div class="code-list-item code-list-item-public "></div>
</div>
But it fails and throws the below error.
Caused by: org.openqa.selenium.InvalidSelectorException: The given selector code-list-item code-list-item-public is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: Compound class names not permitted
For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html
Also, How do I traverse through each of the classes? Each of these contain subparts which I would like to process further individually before moving to the next.