How to automate menu box pop up of right click in python selenium

+3 votes

Hello,

I want to automate / click the menus available after right click. But right click pop up is not supported by Chro Path / F12.

Any suggestions how to do it with Python-Selenium.

Thanks In Advance.

ADS...

Aug 9, 2019 in Selenium by ADS
• 280 points
8,421 views

1 answer to this question.

+2 votes

You can use keys to do this. Here's the code snippet:

img = driver.find_element_by_xpath('//img')
actionChains = ActionChains(driver)
actionChains.move_to_element(img).context_click().send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
answered Aug 9, 2019 by Shubham
Hey Shubham,

Thanks but it is not what I am looking for and working.

If I click on blank area of any web page (e.g. google) then I could view above native context menus. and if I want to choose 'Reload', 'Save as' and others then there is no any Xpath or other locators then how to click these options using python selenium that is what I want.

Thanks !
Yes, you don't have xpath for the context menu. The workaround is to right-click and then use arrow keys to go to that particular option.
Ya, but if I want to choose the option 'Cast' or 'Print' then how and where to pass this value ?

When I use above code it clicks but it scrolls web page and not showing selection of options from the context menu.
Which browser you are using to perform the automation?

Related Questions In Selenium

0 votes
1 answer

How to handle Pop-up in Selenium WebDriver using Java

Actually, its pretty simple. Use this code ...READ MORE

answered Apr 6, 2018 in Selenium by nsv999
• 5,500 points
10,515 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,772 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,567 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,084 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,178 views
0 votes
2 answers

Unable to Click on an Element in Selenium (Python) even after finding it.

Here, I give you working script which ...READ MORE

answered Sep 19, 2018 in Selenium by Priyaj
• 58,100 points
24,068 views
+10 votes
17 answers

How to automate gmail login process using selenium webdriver in java?

Check the below code: Here is the working ...READ MORE

answered Apr 24, 2018 in Selenium by Vardy
• 2,360 points
197,673 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP