Issue
This is the HTML for the table row I don't want to extract:
<tr class="items" data-href="#" style="display: none;">
And this is the one I want to extract:
<tr class="items" data-href="#" style>
Python 3.10.7, Selenium Webdriver 4.17.2
I tried using solutions I found on the internet, but the solutions used an older version of selenium
Edit: results = driver.find_elements(By.CLASS_NAME, "table_title")
extracts the text that I need, but it also extracts blank lines from all the <tr>
tags that contain style='display: none;'
. This significantly slows my program.
Solution
Use :not()
clause of css selector to ignore the elements contains style='display: none;'
results = driver.find_elements(By.CSS_SELECTOR, "tr[class='items']:not([style='display: none;'])")
Answered By - KunduK
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.