How can i use 'Right click' option in the Selenium to select the context menu option

2,211 views
Skip to first unread message

Vijay (Lucky)

unread,
Sep 15, 2011, 6:30:50 AM9/15/11
to Selenium Users
Hi All,

How can i use 'Right click' option in the Selenium to select the
context menu option

1. menu favorites
http://www.imagehousing.com/image/851062

2. context menu for menu favorites
http://www.imagehousing.com/image/851064

Mark Collin

unread,
Sep 15, 2011, 6:54:09 AM9/15/11
to seleniu...@googlegroups.com
Didn't somebody already answer this in one of your other threads? It's
certainly been asked and answered in the past day:

WebElement foo = driver.findElement(By.xpath("//div[.='foo']"));
Actions builder = new Actions(driver);
builder.contextClick(foo).perform();

Hi All,

--
You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to
selenium-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/selenium-users?hl=en.


--
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

If you have received this email in error please notify postm...@ardescosolutions.com

Vijay (Lucky)

unread,
Sep 15, 2011, 7:31:30 AM9/15/11
to Selenium Users
Hi Collin,

I dint get you...

Is this ssoluton for the webdriver ?

I am using the Selenium RC with JAVA


Vijay

Krishnan Mahadevan

unread,
Sep 15, 2011, 7:36:58 AM9/15/11
to seleniu...@googlegroups.com
Have you tried 
selenium.contextMenu(locator) or 
selenium.contextMenuAt(locator, coordString) ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




--

Vijay (Lucky)

unread,
Sep 15, 2011, 8:06:22 AM9/15/11
to Selenium Users
Right click is not recorded when I record the tests

I added selenium.contextMenu(locator) >> dint work

I want to add selenium.contextMenuAt(locator, coordString)

How can I give the parameter "coordString"

Pls help me..

Vijay (Lucky)

unread,
Sep 15, 2011, 8:07:24 AM9/15/11
to Selenium Users
FYI

I'm trying these in the Selenium IDE...

Mark Collin

unread,
Sep 15, 2011, 9:12:59 AM9/15/11
to seleniu...@googlegroups.com
In that case try using the ' contextMenu' command

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Vijay (Lucky)
Sent: 15 September 2011 13:07
To: Selenium Users
Subject: [selenium-users] Re: How can i use 'Right click' option in the
Selenium to select the context menu option

FYI

--

You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to
selenium-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/selenium-users?hl=en.

Vijay (Lucky)

unread,
Sep 15, 2011, 9:17:02 AM9/15/11
to Selenium Users
@Collin

Mark Collin

unread,
Sep 15, 2011, 9:27:44 AM9/15/11
to seleniu...@googlegroups.com
In that case you will need to provide us with the HTML that shows what is
triggered when you perform a right click. What you have supplied so far
does not show any onclick events.

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Vijay (Lucky)
Sent: 15 September 2011 14:17
To: Selenium Users
Subject: [selenium-users] Re: How can i use 'Right click' option in the
Selenium to select the context menu option

@Collin

--

Vijay (Lucky)

unread,
Sep 15, 2011, 9:55:28 AM9/15/11
to Selenium Users
FYI

In the two image links I've given:

1 >> just element

2 >> click on the element, context menu is displayed

I'll give third one now: Right click on the same element

3 >> http://www.imagehousing.com/image/851331

Hope this info is useful...

If u need anything more.. I ll provide.. Pls help me

Vijay

Vijay (Lucky)

unread,
Sep 15, 2011, 10:06:27 AM9/15/11
to Selenium Users

Mark Collin

unread,
Sep 15, 2011, 10:20:12 AM9/15/11
to seleniu...@googlegroups.com
Bleh it wants my e-mail address and stuff

-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Vijay (Lucky)
Sent: 15 September 2011 15:06
To: Selenium Users
Subject: [selenium-users] Re: How can i use 'Right click' option in the
Selenium to select the context menu option

http://www.filehosting.org/file/details/267024/favorites_contextmenu_prob.tx
t

--

Mark Collin

unread,
Sep 15, 2011, 10:49:55 AM9/15/11
to Vijay (Lucky), seleniu...@googlegroups.com
I would suggest sending it to the list, my mail server doesn't let messages
through unless a specific exclusion is added and won't let the majority of
attachments through.

Secondly if you send it to the list lots of people will see it and you will
probably get a quicker response as well as sharing information with other
people who get stuck at this point.

-----Original Message-----
From: Vijay (Lucky) [mailto:indi...@gmail.com]
Sent: 15 September 2011 15:37
To: Mark Collin
Subject: Re: How can i use 'Right click' option in the Selenium to select
the context menu option

I've sent html file thru mail from ***


plss check in Spams tooo!!!


I need ur help ....


I need to implement the tests... target s there tom.. I'm stuck only with
this I guess....


plsss help me out

Ramesh A

unread,
Sep 15, 2011, 11:51:59 AM9/15/11
to seleniu...@googlegroups.com, Vijay (Lucky)
Hi Vijay,

The best way to deal with right click is to make use of "java.awt.*  This makes your work simple.  The awt package has all the options which u can do from keyboard and mouse.  I have used the same thing in my selenium Test.

Some of the useful things for ur tests would be
selenium.mouseDownRight(String locator)
selenium.mouseDownRightAt(String locator, String coordString)
selenium.mouseUpRight(String locator)=
selenium.mouseUpRight(String locator, String coordString)

Hope this will help you out in achieving the solution.  Let me know how it goes


--
With Cheers & Regards
Ramesh

"Pleasure in the job puts perfection in the work."


328.png
Message has been deleted

Mark Collin

unread,
Sep 16, 2011, 3:59:57 AM9/16/11
to seleniu...@googlegroups.com
Just use something like pastebin that doesn't require an account:

http://pastebin.com/


-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Vijay (Lucky)
Sent: 16 September 2011 05:18
To: Selenium Users

Subject: [selenium-users] Re: How can i use 'Right click' option in the
Selenium to select the context menu option

@Collin

Yes I do agree with u Collin..

But the problem is :

As u know we cannot attach any files through this reply..

So please let me know how should I send the attachments to all here..in this
forum

Waiting for ur reply!

Vijay

--
You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to
selenium-user...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/selenium-users?hl=en.

Vijay (Lucky)

unread,
Sep 16, 2011, 4:09:31 AM9/16/11
to Selenium Users
pleqse find the html here

http://pastebin.com/4UdeWTna

Mark Collin

unread,
Sep 20, 2011, 5:30:43 AM9/20/11
to seleniu...@googlegroups.com
Right, I've had a look and I'm afraid I'm not going to be much help. The
markup you showed in your screenshot is not in the HTML you have supplied so
it looks like it is being built on the fly with jQuery. The HTML you have
supplied is calling multiple JavaScript scripts that I can't see and the
French (I think) variable names don't really provide much meaning to me.

I can see click events, mouseout, and mouseover events, but no right click
events. I can also see iFrames so it is possible that some of these layers
are being built within iFrames which you need to switch to, to be able to
interact with the elements contained within them.

Hopefully the above will give you some pointers as to where to look but this
looks like a problem that is going to require access to the site, a copy of
your test script and clear instructions as to what you are trying to do.


-----Original Message-----
From: seleniu...@googlegroups.com
[mailto:seleniu...@googlegroups.com] On Behalf Of Vijay (Lucky)
Sent: 16 September 2011 09:10
To: Selenium Users
Subject: [selenium-users] Re: How can i use 'Right click' option in the
Selenium to select the context menu option

http://pastebin.com/4UdeWTna

--

Reply all
Reply to author
Forward
0 new messages