Selenium Python : Unable to get element by id/name/css selector
<p>For a school project, I'm trying to create a Python Script which is able to fill in different forms, from different websites.</p>

<p>Here is the thing, for some kinds of website, I'm not able to catch the form elements which Selenium.
E.g. in this website : <a href="http://www.top-office.com/jeu" rel="nofollow">http://www.top-office.com/jeu</a>
Where I inspect the page with firefox, the input "Name" box has the id "lastname", but Selenium is not able to get it. And when I display the html code of this page, the form looks like being included from another page or something.</p>

<p>I tried to getelementbyid, byname, bycssselector, etc.
I also tried to wait for the page to be entirely loaded by using WebDriverWait(driver, 5), but it still do not work.</p>

<p>Do you have any solutions or suggestions ?</p>

<p>PS : Even with javascript, I'm not able to get this element by id</p>

<p>Thanks</p>

<p>The element that you are trying to interact with is inside of an iframe. You need to use the <code>driver.switch_to_frame()</code> method in order to switch the driver to focus on that iframe. Only when it has switched into that iframe can it interact with its elements. </p>

<p>See <a href="http://stackoverflow.com/questions/7534622/selecting-an-iframe-using-python-selenium">this post</a> on how to use it. You can locate the iframe using xpath, like this: <code>//iframe[@src = 'https://adbx.me/grandjeuclubmed/']</code>. Then, you can use the code mentioned in the post I gave you.</p>

javascript jquery python selenium