I'm trying to print and/or write to file text inside a span tag from the following HTML. Only want it to find_element once, not find_elements since there's only one instance:
<div>
<span class="test">2</span>
</div>
Below is the python code I'm using that is generating the "'WebElement' object is not iterable" error.
test = driver.find_element_by_xpath("/html/body/div")
for numberText in test:
numberTexts = numberText.find_element_by_class_name("test")
print(numberTexts.txt)