Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7585621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:13:14+00:00 2026-05-30T19:13:14+00:00

For example, here’s part of the source: <div id = eg_1_2_3_0399483 style = visibility:

  • 0

For example, here’s part of the source:

<div id = "eg_1_2_3_0399483" style = "visibility: visible; display: block;">
    <iframe id = "default_23342522" src="http://example.com/random_string_skdfjgklsjklf" style = "height: 600px;">
...

<div id = "eg_238_2348927" style = "visibility: hidden; display: none;">
    <iframe ...

You see, there’s multiple iframe in the source, what I really want to locate is <iframe id = "default_23342522" src="http://example.com/random_string_skdfjgklsjklf" style = "height: 600px;"> but as the id and src keep changing each time you load the page, so basically I would first locate <div id = "eg_1_2_3_0399483" style = "visibility: visible; display: block;"> then go for its child node, the problem is, how do you do that? Well I know the way to locate the first <div> element is like this:

element = browser.find_elements_by_xpath("//div[@style='visibility: visible; display: block;']")

And then?

Or maybe some better ideas on how to locate the iframe element above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:13:15+00:00Added an answer on May 30, 2026 at 7:13 pm

    Try this:

    element = browser.find_elements_by_xpath("//div[@style='visibility: visible; display: block;']/iframe[@style='height: 600px;']")
    

    If you want only the first iframe in the specified div each time (as shown in your answer), do then

    iframe=element[0]
    

    If you want to extract what is inside the iframe then you can do this:

    iframe_content = iframe.text
    

    An alternative way to locate the first iframe of the specified div is by using a similar function that returns one item instead of a list:

    element = browser.find_element_by_xpath("//div[@style='visibility: visible; display: block;']/iframe[1]")
    

    Above we used find_element_by_xpath instead of find_elements_by_xpath to just locate the first iframe of the specified div. Take in mind that I didn’t specified the iframe by its style (e.g. height: 600px). But this can be done here too in a similar way as I explained above using find_elements_by_xpath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See the example here: http://users.telenet.be/prullen/portfolio.html I've tried setting my images to display:block - display:
Example here: http://jsfiddle.net/7h2Dh/ Got this html: <span>Text<div id=wtf>Content</div>Text</span> I need to set div display
i have this simple example here : http://jsfiddle.net/pTyvc/1/ i don't want the sub_menu div
EDIT: Example here: [Live example removed - question answered] I'm trying to display this
Following the example here: http://www.quirksmode.org/dom/execCommand/ I've discovered that I need an iframe for the
I followed the example here -- https://github.com/facebook/php-sdk : require 'php-sdk/src/facebook.php'; $facebook = new Facebook(array(
example here: http://jsfiddle.net/R7GUZ/3/ I'm having a heck of a time getting list-style to work
Example: here is the string: blablabla123:550:404:487blablabla500:488:474:401blablablabla here is what I'm using: string reg =
Example here: http://jezebel.com/5896408/racist-hunger-games-fans-dont-care-how-much-money-the-movie-made Click on the 3x3 Tweets screencap they have up. I love
I found an example here to create a select list with optgroups using KnockoutJS.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.