i've been dealing with this for a few days and now i give up with searching and trying out
i'm writing a testCase with selenium, it's about a form that is hidden and after pressing some button it gets visible (using a bootstrap function "whatever.show()"). As i'm new with selenium the first thing i tried was make the testcase with seleniumIDE where everything worked fine, then exported to pyhon file, and when i attempt to excecute the script, it breaks saying that the element is not visible. i tried to wait until the element gets visible but never does. the function i tried for gets visible was
try:
element = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.ID, "Email"))
)
finally:
driver.quit()
there's something else, they have another panel with a input with id="Email" inside of it, but i tried to first get the panel to find the element, after clicked the button no panel gets visible for selenium despite when it's running i can see the panel visible after clicked the button
terceroPanel = driver.find_element_by_id("divFormTercero")
argosPanel = driver.find_element_by_id("divFormArgos")
emailInput = argosPanel.find_element_by_id("Email")
print(terceroPanel.is_displayed())
print(argosPanel.is_displayed())
print(emailInput.is_displayed())
emailInput.clear()
emailInput.send_keys("andresmaur...@gmail.com")
argosPanel is the panel of my interest, terceroPanel is the other one, the three console output are "False"
the complete code i tried last was
driver.get(self.base_url + "/IngresosOnline/")
driver.find_element_by_css_selector("#btnUserArgos").click()
try:
element = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.ID, "Email"))
)
finally:
driver.quit()
terceroPanel = driver.find_element_by_id("divFormTercero")
argosPanel = driver.find_element_by_id("divFormArgos")
emailInput = argosPanel.find_element_by_id("Email")
print(terceroPanel.is_displayed())
print(argosPanel.is_displayed())
print(emailInput.is_displayed())
emailInput.clear()
emailInput.send_keys("andresmaur...@gmail.com")
it breaks when send the keys. even i could see the input getting focus before throw the exception
Thanks a lot if someone can give me a hand with this.
here the HTML, the code is not mine, i'm testing the app of some partners
div class="col-md-12" id="divFormArgos" hidden>
<section id="loginFormArgos">
<form action="/IngresosOnline/Account/Login" class="form-horizontal" method="post" role="form"><input name="__RequestVerificationToken" type="hidden" value="CwUxjXIIsx9b0IXeDhdb7FXlhTiMuYusRMvjZjG2KIXFfSi8lhC_4j19OXZKzU8bfffxY5d_1cmzigNUCcd78AJDf7_DZXGmhnQ_ayWWWks1" /> <h4>Use una cuenta Argos para iniciar sesión.</h4>
<hr />
<div class="form-group">
<label class="col-md-4 control-label" for="Email">Correo electrónico</label>
<div class="col-md-8">
<input class="form-control" data-val="true" data-val-email="El campo Correo electrónico no es una dirección de correo electrónico válida." data-val-required="El campo Correo electrónico es obligatorio." id="Email" name="Email" type="text" value="" />
<span class="field-validation-valid text-danger" data-valmsg-for="Email" data-valmsg-replace="true"></span>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="Password">Contraseña</label>
<div class="col-md-8">
<input class="form-control" data-val="true" data-val-required="El campo Contraseña es obligatorio." id="Password" name="Password" type="password" />
<span class="field-validation-valid text-danger" data-valmsg-for="Password" data-valmsg-replace="true"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
<input data-val="true" data-val-required="El campo ¿Recordar cuenta? es obligatorio." id="RememberMe" name="RememberMe" type="checkbox" value="true" /><input name="RememberMe" type="hidden" value="false" />
<label for="RememberMe">¿Recordar cuenta?</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Iniciar sesión" class="btn btn-primary" />
<a class="btn btn-danger" id="btnCancelar1">Cancelar</a>
</div>
</div>
<br />
</form>
</section>
i've been dealing with this for a few days and now i give up with searching and trying out
i'm writing a testCase with selenium, it's about a form that is hidden and after pressing some button it gets visible (using a bootstrap function "whatever.show()"). As i'm new with selenium the first thing i tried was make the testcase with seleniumIDE where everything worked fine, then exported to pyhon file, and when i attempt to excecute the script, it breaks saying that the element is not visible. i tried to wait until the element gets visible but never does. the function i tried for gets visible was
try: element = WebDriverWait(driver, 10).until( EC.visibility_of_element_located((By.ID, "Email")) ) finally: driver.quit()
there's something else, they have another panel with a input with id="Email" inside of it, but i tried to first get the panel to find the element, after clicked the button no panel gets visible for selenium despite when it's running i can see the panel visible after clicked the button
terceroPanel = driver.find_element_by_id("divFormTercero") argosPanel = driver.find_element_by_id("divFormArgos") emailInput = argosPanel.find_element_by_id("Email") print(terceroPanel.is_displayed()) print(argosPanel.is_displayed()) print(emailInput.is_displayed()) emailInput.clear()
emailInput.send_keys("andresmauricio...@gmail.com")
argosPanel is the panel of my interest, terceroPanel is the other one, the three console output are "False"
the complete code i tried last was
driver.get(self.base_url + "/IngresosOnline/") driver.find_element_by_css_selector("#btnUserArgos").click() try: element = WebDriverWait(driver, 10).until( EC.visibility_of_element_located((By.ID, "Email")) ) finally: driver.quit() terceroPanel = driver.find_element_by_id("divFormTercero") argosPanel = driver.find_element_by_id("divFormArgos") emailInput = argosPanel.find_element_by_id("Email") print(terceroPanel.is_displayed()) print(argosPanel.is_displayed()) print(emailInput.is_displayed()) emailInput.clear()
emailInput.send_keys("andresmauricio...@gmail.com")