<clickElement> not executing onClick JS code of dynamically rendered tag

View: New views
3 Messages — Rating Filter:   Alert me  

<clickElement> not executing onClick JS code of dynamically rendered tag

by Otto, Sam E :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have an HTML page that executes a search, returning the results (an HTML table) via an 'AJAX call' which renders the table in a <div> tag on the page.  The TR tags of the AJAXed table have a unique id and an onClick attribute.  When using the <clickElement> tag in my WebTest script, the onClick event is not executed. The <clickElement> step is successful, just the javascript for the onClick was not run. 
 
Is this a limitation of the HTML/JavaScript engine that it won't execute events associated with dynamically rendered elements (elements that were not on the page originally)?
 
Thanks
 
Sam
NOTICE: This e-mail and any files transmitted with it may contain confidential or privileged information that is intended only for the use of the individual or entity to whom they are addressed. This information should be treated with the appropriate level of security to preclude the disclosure of sensitive or privileged information.  If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is prohibited. If you have received this e-mail in error, please notify the sender, delete this e-mail from your machine's memory, and destroy the hardcopy information. Thank you.


Re: <clickElement> not executing onClick JS code of dynamically rendered tag

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

can you please try with latest WebTest build that integrates HtmlUnit-2.6.

Cheers,
Marc.
--
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com

Otto, Sam E wrote:

> I have an HTML page that executes a search, returning the results (an
> HTML table) via an 'AJAX call' which renders the table in a <div> tag on
> the page.  The TR tags of the AJAXed table have a unique id and an
> onClick attribute.  When using the <clickElement> tag in my WebTest
> script, the onClick event is not executed. The <clickElement> step is
> successful, just the javascript for the onClick was not run.
>  
> Is this a limitation of the HTML/JavaScript engine that it won't execute
> events associated with dynamically rendered elements (elements that were
> not on the page originally)?
>  
> Thanks
>  
> Sam
>
> NOTICE: This e-mail and any files transmitted with it may contain confidential or privileged information that is intended only for the use of the individual or entity to whom they are addressed. This information should be treated with the appropriate level of security to preclude the disclosure of sensitive or privileged information.  If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is prohibited. If you have received this e-mail in error, please notify the sender, delete this e-mail from your machine's memory, and destroy the hardcopy information. Thank you.
>

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest

Re: <clickElement> not executing onClick JS code of dynamically rendered tag

by Rhee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All

I have a similar issue with js trying to click on the results from the table.

            <clickElement XPath ="//*[@class='cSearchResultsR1B1' and contains(text(),'Analog')]"
                description="Select results" />

<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <col style="cursor:hand; padding-left:2px">
   
            <tr onClick="parent.SaveForm('Y', '546', 'Analog')"

onMouseOver="SetPSLookupRowBGColor(this)" onMouseOut="SetPSLookupRowBGColor(this)">
                <td class="cSearchResultsR1B1">Analog</td>
            </tr>       
</table>

clickElement passes but page does not change.

Canoo Webtest (R_1781)
Tried w/ HTMLUnit 2.6 and the latest 2.7 snap shot ( build.1590  09/10/2009 11:18:12) and got the same results

Thanks
-Rhee

On Fri, Sep 4, 2009 at 4:34 AM, Marc Guillemot <mguillemot@...> wrote:
Hi,

can you please try with latest WebTest build that integrates HtmlUnit-2.6.

Cheers,
Marc.
--
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com


Otto, Sam E wrote:
I have an HTML page that executes a search, returning the results (an HTML table) via an 'AJAX call' which renders the table in a <div> tag on the page.  The TR tags of the AJAXed table have a unique id and an onClick attribute.  When using the <clickElement> tag in my WebTest script, the onClick event is not executed. The <clickElement> step is successful, just the javascript for the onClick was not run.  Is this a limitation of the HTML/JavaScript engine that it won't execute events associated with dynamically rendered elements (elements that were not on the page originally)?
 Thanks
 Sam

NOTICE: This e-mail and any files transmitted with it may contain confidential or privileged information that is intended only for the use of the individual or entity to whom they are addressed. This information should be treated with the appropriate level of security to preclude the disclosure of sensitive or privileged information.  If you are not the intended recipient, you are hereby advised that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is prohibited. If you have received this e-mail in error, please notify the sender, delete this e-mail from your machine's memory, and destroy the hardcopy information. Thank you.


_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest



--
- Rhee

"Risk nothing and you gain nothing"