I've been searching for how to solve this but can't seem to find anything that works for me. Hope someone can help.
I'm on a website using python and selenium chrome browser and trying to log into a website which has the following HTML where you enter the username or email:
<div>
<span class="g-hdn" id="1986367435LabelSpan"><label for="1986367435">Email or username</label></span>
<label for="1986367435">Email or username</label>
</span>
<span>
<input size="40" maxlength="64" name="1986367435" id="1986367435" type="text" autocapitalize="off" autocorrect="off" placeholder="Email or username" class="fld">
</span>
</div>
<input name="runId2" type="hidden" value="AQABAAAAUCjLu3T7Joi/PEg380w56IAM9Zt6nK8i63MlZ+2gBdjoHrnTe3XAyLU4iGu37LvUilofnGbWAcTJFUjq6KhmWxEHtQVaMNfWeeaZUxXe9asa">
I can't select this input using the ID or name as the number is different everytime, so I want to select the input box using the placeholder="Email or username".
Each time I select this placement and try to enter some string I receive an error saying:
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
Which seems to be because of the type="hidden".
Any ideas on how to select this and enter text?
I am currently using the following code to select the placeholder, which is giving the error:
driver.find_element_by_xpath("//input[@placeholder='Email or username']").send_keys("email")
I'm sure sure whether the element is really hidden as I can select the element using the following (once the ID is available):
driver.find_element_by_xpath("//*[@id='1986367435']").send_keys("email")
Many thanks for your help.
Target input field has no
type="hidden"
attribute. It might be not visible initially after page redirection, so you can try to useExplicitWait
to solve this issue: