So, I've got a Selenium webdriver running. I want to extract text from some nodes. I can find them:
In [73]: nodes = driver.find_elements_by_css_selector("rect > title")
In [74]: len(nodes)
Out[74]: 63
But they don't contain any text:
In [75]: for n in nodes:
...: if n.text:
...: print(n.text)
<prints nothing>
But if I open devtools in browser which is connected to this instance of driver, I find the same amount of nodes with this CSS selector - and they definitely contain some text:
So, I've got some nodes with text which is not retrivable by Selenium. Just to make sure, I created a BeautifulSoap from that page's source - and I was able to find elements in question that way and get their text.
In [86]: [a.text for a in s.select("rect > title")]
Out[86]:
['Sometext',
'Sometext',
'Sometext',
'Sometext',
...]
Getting "innerText" instead, as in this question, didn't help. Is that some kind of Selenium bug, or I am doing something wrong? Just in case, there is problematic html.