I would like to get emails from https://spamwc.de/
using Selenium (Python)
.
In html DOM it looks like: document.getElementById("mails").textContent
(it works, when no emails in mailbox it gives "...no mails...", and it's fine)
I would like to get the same result using Selenium.
My code:
try:
mails = self.driver.find_element_by_id("mails").getAttribute("outerHTML")
print("mails:", mails)
except:
print("mails: no outerHTML")
try:
mails = self.driver.find_element_by_id("mails").getAttribute("innerHTML")
print("mails:", mails)
except:
print("mails: no innerHTML")
try:
mails = self.driver.find_element_by_id("mails").getAttribute("textContent")
print("mails:", mails)
except:
print("mails: no textContent")
Result (exceptions: 'WebElement' object has no attribute 'getAttribute'
):
mails: no outerHTML
mails: no innerHTML
mails: no textContent
Of course the element with id="mails"
exists.
Example when mailbox (e.g. test@akkecuwa.ga) is empty:
document.getElementById('mails').textContent
Result:
There are no mails for you, sorry.
I am open to any suggestions.