Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get a specific frame in a web page and retrieve its content
    primarykey
    data
    text
    <p>I wanted to access the translation results of the following url </p> <blockquote> <p><a href="http://translate.google.com/translate?hl=en&amp;sl=en&amp;tl=ar&amp;u=http://www.saltycrane.com/blog/2008/10/how-escape-percent-encode-url-python/" rel="nofollow">http://translate.google.com/translate?hl=en&amp;sl=en&amp;tl=ar&amp;u=http%3A%2F%2Fwww.saltycrane.com%2Fblog%2F2008%2F10%2Fhow-escape-percent-encode-url-python%2F</a></p> </blockquote> <p>the translation is displayed in the bottom content frame out of the two frames. I am interested in retrieving only the bottom content frame to get the translations </p> <p>selenium for python allows us to fetch page contents via web automation:</p> <pre><code>browser.get('http://translate.google.com/#en/ar/'+hurl) </code></pre> <p>The required frame is an iframe :</p> <pre><code>&lt;div id="contentframe" style="top:160px"&gt;&lt;iframe src="/translate_p?hl=en&amp;am... name=c frameborder="0" style="height:100%;width:100%;position:absolute;top:0px;bottom:0px;"&gt;&lt;/div&gt;&lt;/iframe&gt; </code></pre> <p>but how to get the bottom content frame element to retrieve the translations using web automation?</p> <p>Came to know that PyQuery also allows us to browse the contents using the JQuery formalism</p> <p><strong>Update:</strong></p> <p>An answer mentioned that Selenium provides a method where you can do that.</p> <pre><code>frame = browser.find_element_by_tag_name('iframe') browser.switch_to_frame(frame) # get page source browser.page_source </code></pre> <p>but it does not work in the above example. It returns an empty page .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload