I have the following HTML code:
...
<div class="media ipad_media" style="padding-top: 0;">
    <iframe src="//www.youtube.com/embed/XXXXXXXX" frameborder="0" allowfullscreen="allowfullscreen" width="618" height="330" data-gtm-yt-inspected-7182449_30="true"> 
    </iframe>
<div>
...
<div class="media ipad_media hidden-xs">
   <iframe src="//www.youtube.com/embed/XXXXXXXX" frameborder="0" allowfullscreen="allowfullscreen" width="618" height="330" data-gtm-yt-inspected-7182449_30="true">
   </iframe>
</div>
I want the src attribute which is actually the same in both iframes. I just locate the first element by using the following command:
elem = driver.find_element_by_class_name("media.ipad_media").find_element_by_tag_name("iframe")    
I then excute the following:
print(elem.get_attribute('width'))
print(elem.get_attribute('frameborder'))
print(elem.get_attribute('allowfullscreen'))
print(elem.get_attribute('src'))
print(elem.get_attribute('source'))
print(elem.text)
print(elem.tag_name)
I get the following in the console:
618
0
true
None
iframe
How is it possible to get nothing executing print(elem.get_attribute('src'))? As you understand, executing the $$("div.media.ipad_media>iframe") command in the console gives 2
 
    