question

kalika_jain avatar image
kalika_jain asked amichaels converted comment to answer

unable to capture right click

Hii...

 While navigating the device GUI , we need to select certain options bt right clicking on a particular tab. Though iTest is showing the options when we right click on the tab , its not able to capture those steps.

What can be done? ( I am using internal web browser)

 

Thanks

iTestGUI Testing(Web-Java Swing-etc)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

MayH avatar image
MayH answered

iTest will not automatically capture right click actions.  However, there is a workaround.

 

Looking at the source HTML/javascript, what's happening is that when a mouseup event is captured on a particular target, the mouse event gets filtered.  If the button id is that of a right button, the context menu gets brought up on the screen.

 

What you need to do is to manually simulate a right click action, by creating a mouseup event, (with buttonId equals to 2 for right click), and dispatch it on the target.

 

Here's the procedure to "fake" the right click:







procedure   rightClick
eval $session

var rightClickFunction = new Function("
var element = document.getElementById('$elementId');
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('mouseup', true, true, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 2, null);
element.dispatchEvent(evt);
");


eval $session
rightClickFunction();



And you'll call the procedure from your testcase:

  call  rightClick -session <sessionName> -elementId <targetElementId>

 

 

 

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zbwu avatar image
zbwu answered zbwu posted

HI,

 

I have the same question , unable to capture right click.

I am using iTest v4.1.0 build55713 and  internal web browser

While navigating the device GUI , we need to select certain options bt right clicking on a particular tab. Though iTest is showing the options when we right click on the tab , its not able to capture those steps.

And I try the example procedure to "fake" the right click, it seems not working.

What can be done?

Please find the attached screenshot and html source.

Thanks.




2 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tomzhang avatar image tomzhang commented ·

Has this been solved?  In general, how do you perform capture/replay of right-click, using internal browser.

0 Likes 0 ·
zbwu avatar image zbwu tomzhang commented ·

No.

0 Likes 0 ·
PreetS avatar image
PreetS answered amichaels converted comment to answer

I'm not sure how your application is designed, but standard HTML does not have a concept of a right click. Your page might be creating some dynamic HTML menu on right click on the node. 

 

iTest will not capture the right click as such, but may capture the actual selection of the menu item. Can you confirm if that step (clicking on an option) gets captured? This may or may not replay fine. 

 

I think, before I reccomend a work around, could you attach a screenshot of the page with the right click menu? and also the XML  snapshot response of the page. (Go the the page and click o the snapshot button in the toolbar. Copy the response of that snapshot action and attach it)

 

This will help me figure out what might actually  be going on behind the scenes. 

 

 

5 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kalika_jain avatar image kalika_jain commented ·

hiii...

Yes,Since its the webUI of a device,I think the page is dynamically generating the right click menu,according to the configurations of the device.

But the iTest is not even capturing the actual selection of the menu. Therefor its not able to find the fields on the next page( which is displayed after selection from the right click menu.) and hence the TC is not able to proceed further.

 

I am hereby attaching the scrrenshot and XML response of the right click page.

 

Thanks...

Message Edited by kalika_jain on 04-05-2009 11:03 PM
0 Likes 0 ·
right_click.jpg (157.6 KiB)
right_click_xml.txt (113.8 KiB)
right_click_xml.txt (113.8 KiB)
KumarS avatar image KumarS kalika_jain commented ·
It looks like a Java applet embedded inside the browser. iTest web application does not support applet testing directly.
0 Likes 0 ·
PreetS avatar image PreetS KumarS commented ·

Looking at the XML snapshot, it is not a java applet.

iTest does not capture right click actions, however it would be possible to manually add a step or two to make these menu items work. 

 

I'll study the javascript on the page and get back to you. 

0 Likes 0 ·
kalika_jain avatar image kalika_jain PreetS commented ·

Please resolve this query!!!!!

0 Likes 0 ·
PreetS avatar image PreetS kalika_jain commented ·

From what I can see, iTest will actually capture the action of clicking the menu item. What iTest will not capture is the action of right clicking to bring up the menu.

If there is a way to call a javascript method to bring up the menu, then that would be a workaround. You can invoke the javascript method using the 'eval' action.

 

e.g. if there is a javascript method called showContexMenu() your test case steps will looke like

 

eval  showContextMenu

click <xpath target to the menu item>

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.