Selenium.click finds my html form submit element, but not doing the submit

116 views
Skip to first unread message

Dave Reichert

unread,
Dec 7, 2007, 1:54:16 PM12/7/07
to selenium-users...@googlegroups.com
Selenium is not performing the onsubmit method associated with an input of type="submit" on my html form.

The form allows the user to populate a search string, then click on a search button to submit the string.

With Selenium, I'm able to locate and populate the text box

*selenium.isElementPresent("quickSearch")*
*selenium.type("quickSearch", "paper")*

and also locate and click on the search button.

*selenium.isElementPresent("quickSearchSubmit")*
*selenium.click("quickSearchSubmit")*

But it times out because the form submit never happens.

I've included an abbreviated copy of the form, showing only these two elements (the text box and the button). If you need to reference the entire form, that's also attached at the very bottom. But I tried to weed out the clutter that I think is not relevant. The submit button is bolded, and should perform the following action: onsubmit="return processHeaderSearchSubmit()"


{code:html}<form name="FIT_globalSForm" id="FIT_globalSForm" action="http://uscobrmfa-ld-75:9002/coe/ce.portal?_nfpb=true&amp;_windowLabel=instLblHeaderPortlet&amp;instLblHeaderPortlet_actionOverride=%2Fhome%2Fheader%2FprocessGlobalSearchInput" method="get" onsubmit="return processHeaderSearchSubmit()">

<input type="text" id="quickSearch" name="globalsearch"
maxlength="30"
onKeyDown="return submitAutoCompleteForm(event);"
value="Search By Keyword or Item#"/>
<div id="qsAutoComplete"></div>{code}


*<input type="submit" id="quickSearchSubmit" class="button" value="Search">*

</form>

Note that there is some logic in processHeaderSearchSubmit() to first make sure that the text field was populated before it allows the form submit to occur. So it's possible that the onsubmit action is happening, but that it's not recognizing that we've populated the search text. Not likely though because I see the field populate when I run via Selenium IDE and through Selenium RC.

The following output was captured when reproducing the problem in Selenium IDE:


* [info] Executing: |open | /coe/ce.portal | |

* [info] Executing: |type | quickSearch | paper |

* [info] Executing: |clickAndWait | quickSearchSubmit | |

* [warn] triggerMouseEvent assumes setting screenX and screenY to 0 is ok

* [info] element doesn't have fireEvent

* [info] element has initMouseEvent

* [error] Timed out after 30000ms

Thanks in advance, for your help!

Full html form page source is below.

-dave

-
------------------------------------------------------------
{code:html}<form name="FIT_globalSForm" id="FIT_globalSForm" action="http://uscobrmfa-ld-75:9002/coe/ce.portal?_nfpb=true&amp;_windowLabel=instLblHeaderPortlet&amp;instLblHeaderPortlet_actionOverride=%2Fhome%2Fheader%2FprocessGlobalSearchInput" method="get" onsubmit="return processHeaderSearchSubmit()">
<input type="hidden" name="instLblHeaderPortletorg.apache.struts.taglib.html.TOKEN" value="02105a8da7fc26f1b530af4999336939">
<input type="hidden" name="_nfpb" value="true">
<input type="hidden" name="_windowLabel" value="instLblHeaderPortlet">
<input type="hidden" name="instLblHeaderPortlet_actionOverride" value="%2Fhome%2Fheader%2FprocessGlobalSearchInput">
<a href="#"></a>

<span>
<input type="text" id="quickSearch" name="globalsearch"
maxlength="30"
onKeyDown="return submitAutoCompleteForm(event);"
value="Search By Keyword or Item#"/>
<div id="qsAutoComplete"></div>
</span>

<script type="text/javascript">
var mySchema = ["suggestions","searchTerm","numResults"];

// Instantiate XHR DataSource
var myXHRDS = new YAHOO.widget.DS_XHR("/coe/suggest", mySchema);
initDS(myXHRDS);

// Instantiate AutoComplete
var myAutoComp = new YAHOO.widget.AutoComplete("quickSearch","qsAutoComplete", myXHRDS);
initAC(myAutoComp);
</script>
<input type="submit" id="quickSearchSubmit" class="button" value="Search">
<script language="JavaScript" type="text/JavaScript">
<!--
-->
</script>
<br>
<span style="color: red;font-weight: bold;"></span>
</form>{code}

Edited by: dave_reichert on Dec 7, 2007 3:08 PM

Reply all
Reply to author
Forward
0 new messages