Dialogbox are not popuped when we click a link

2 views
Skip to first unread message

deepa

unread,
Jun 24, 2009, 9:25:02 AM6/24/09
to watij
Hi

In our application, i have a link and when we click on that , it
should pop up a dialog box through watij i was trying to invoke that
call,using (ie.childBrowser().divs().div(id,
"selectMembershipTypeLink").click();). But dialogbox is not coming up.
Internally in application it is handled through an AJAX call ,(<a
helpkey="SELECTTHEMEMBERSHIPTYPEFD" tabindex="4"
onfocus="setFocusComponent(this)" class="iLoyalLink"
onclick="A4J.AJAX.Submit('_viewRoot','manageProgramForm',event,
{'parameters':
{'manageProgramForm:selectMembershipTypeLnk':'manageProgramForm:selectMembershipTypeLnk'},'actionUrl':'/
bmi/ManageProgram.faces','oncomplete':function(request,event,data)
{onAjaxComplete()}});return false;"
name="manageProgramForm:selectMembershipTypeLnk"
id="manageProgramForm:selectMembershipTypeLnk" href="#">Select the
Membership Type</a> )

Is it because of the internal AJAX call which is causing an issue??
Any idea. please help.

Regards
Deepa V

Darrell Grainger

unread,
Jun 24, 2009, 9:44:10 AM6/24/09
to wa...@googlegroups.com
Your call is going to a childBrowser() and looking for:

<div id='selectMembershipTypeLink'>

and clicking on it. Is this really want you want to find and click? The HTML snippet you provided does not have any such <DIV> tag. What is the error when you run the code? Does it return an exception? Does it just hang? When done manually, are you clicking on the text 'Select the Membership Type'? If what you REALLY want to automate is the clicking of the anchor with attribute helpkey='SELECTTHEMEMBERSHIPTYPEFD' then you can achieve this with:

Finder selectMembershipTypeLinkFinder = xpath("//A[@helpkey='SELECTTHEMEMBERSHIPTYPEFD']");
Link selectMembershipTypeLink = ie.link(selectMembershipTypeLinkFinder);
assertTrue(selectMembershipTypeLink.exists());
selectMembershipTypeLink.click();



2009/6/24 deepa <deepadr...@gmail.com>

deepa

unread,
Jun 25, 2009, 6:04:18 AM6/25/09
to watij

Hi,

I am extracting 2 types of code from our project :-

<div id="selectMembershipTypeLink">
<a id="manageProgramForm:selectMembershipTypeLnk" class="iLoyalLink"
helpkey="SELECTTHEMEMBERSHIPTYPEFD" tabindex="4"
onfocus="setFocusComponent(this)" onclick="A4J.AJAX.Submit
('_viewRoot','manageProgramForm',event,{'parameters':
{'manageProgramForm:selectMembershipTypeLnk':'manageProgramForm:selectMembershipTypeLnk'},'actionUrl':'/
bmi/ManageProgram.faces','oncomplete':function(request,event,data)
{onAjaxComplete()}});return false;"
name="manageProgramForm:selectMembershipTypeLnk" href="#">Select the
Membership Type</a>
</div>


<div id="attachLink">
<a id="sendmembermsgForm:addLnk" class="iLoyalLink"
onclick="A4J.AJAX.Submit('_viewRoot','sendmembermsgForm',event,
{'parameters':
{'sendmembermsgForm:addLnk':'sendmembermsgForm:addLnk'},'actionUrl':'/
bmi/SendMessage.faces','oncomplete':function(request,event,data)
{onAjaxComplete()}});return false;" name="sendmembermsgForm:addLnk"
href="#">Attachments : </a>
</div>


The issue what we are facing is when we click on any of the link in
any of the above i.e either 'Select the Membership Type' or
'Attachments :', we are supposed to get a pop-up window .

But we are not getting the pop-up window. Need you help in solving
this issue ?


Answer to the Questions which you have asked
-------------------------------------------------
What is the error when you run the code? we are not getting any
error , only issue we are not able to invoke the alert or the dialog
window from the link.

Does it return an exception? No Exception are thrown

Does it just hang? The testcase runs but not getting the expected
result.

When done manually, are you clicking on the text 'Select the
Membership Type'? When done manually this window is coming without any
issue from the link. Through Watij when tried no response is
happening.

Stefan

unread,
Jun 25, 2009, 6:32:26 AM6/25/09
to watij
Hi,

Try to use fireEvent("onclick") and see if it helps.

Regards

/Stefan

On Jun 25, 12:04 pm, deepa <deepadrisya...@gmail.com> wrote:
> Hi,
>
> I am extracting 2 types of code from our project :-
>
> <div id="selectMembershipTypeLink">
> <a id="manageProgramForm:selectMembershipTypeLnk" class="iLoyalLink"
> helpkey="SELECTTHEMEMBERSHIPTYPEFD" tabindex="4"
> onfocus="setFocusComponent(this)" onclick="A4J.AJAX.Submit
> ('_viewRoot','manageProgramForm',event,{'parameters':
> {'manageProgramForm:selectMembershipTypeLnk':'manageProgramForm:selectMembe­rshipTypeLnk'},'actionUrl':'/

deepa

unread,
Jun 25, 2009, 6:43:59 AM6/25/09
to watij


Hi,

we tried with fireEvent("onclick") and fireEvent("onmouseup") . But
didn't get a solution.

Stefan

unread,
Jun 26, 2009, 5:16:33 AM6/26/09
to watij
Could you please provide the line of code for the fireEvent
("onclick")?

/Stefan

deepa

unread,
Jun 29, 2009, 7:41:01 AM6/29/09
to watij
Hi

This is the statement which i used .
ie.childBrowser().links().link("text","Select Membership
Type").fireEvent("onclick");

Other than this i tried with div Id -ie.childBrowser().divs().div
(id,"selectMembershipTypeLink").fireEvent("onclick");
Any of these actions are not able to invoke the pop up dialog. Any
attempts throws object not found null pointer exception in my IDE.

Deepa

boltick

unread,
Jun 29, 2009, 12:41:41 PM6/29/09
to watij
Hi

If you use the following code:
ie.childBrowser().links().link("text","Select Membership
Type").fireEvent("onclick");

you will never find required element, because text in your link is
"Select the Membership Type" (see you first post).
Reply all
Reply to author
Forward
0 new messages