Selecting nested iframes with Selenium in Python
<p>I'm trying to automate the filling out of an Easily Apply job application on Indeed. <a href="http://www.indeed.com/viewjob?jk=2e3d019aa34a2801&amp;q=bartender&amp;tk=1a9g51n08a3iof6h&amp;from=web&amp;advn=5333586156877432&amp;sjdu=UvkB_mgi5f7NyMagFcTHP0E6zA3mclLGHWb8Kte-0FV3cY2ZuZvj3LUvh8wnnxrqeYWG3HpvTXBK3G4htWfwgfQeMa0N1Tds6VxYb4V3Vlg&amp;pub=4a1b367933fd867b19b072952f68dceb" rel="nofollow">Here</a> is an example of a job application on Indeed that uses the Easily Apply approach. I've tried every which way to navigate the nested iframes; however, I cannot find an approach that works. I even found that this question has been asked before, unfortunately, the solution given to the question does not work for me. Below is my code as it stands now:</p>

<pre><code>from selenium import webdriver

driver = webdriver.Firefox()

driver.get('indeed_url_goes_here')

driver.find_element_by_class_name('indeed-apply-button').click()
driver.switch_to_frame(driver.find_element_by_xpath('/html/body/iframe'))
driver.switch_to_frame(driver.find_element_by_xpath('//*[@id="indeedapply-modal-preload-iframe"]'))
driver.find_element_by_class_name('applicant.name')
</code></pre>