I've a dynamically generated iframe element (input type) and need to store it as a variable. The iframe looks like:
<iframe id="iframe39993" class="green tea" src="...foo">
#document
<!doctype html>
<html>
<head>...</head>
<body style>
<div id="layout" class=container>
<div class="row">
<input class="required" type="number">
</div>
</div>
</body>
</html>
I'm using Selenium/Webdriver to do this:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
driver.switch_to.frame(driver.find_element_by_class_name('green tea'))
content = WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//* [@id='layout']/div[1]/input")))
print(content.text)
driver.switch_to.default_content()
driver.quit()
For some reason I get only a newline (empty string) as output. I'm pretty sure, that the xpath should be correct, but can't print (or store) the iframe element. The iframe element contains already user input data, which I need to access. Someone any ideas?