1

I am trying to click on right click menu and i am able to open the right click menu but its not clicking on any menu or not pressing any keys like down , up etc where i am wrong :

profile_pic=driver.find_element_by_css_selector('img[class="profilePic img"]')
okl=profile_pic.click()
time.sleep(5)
action1=ActionChains(driver)
action1.context_click(okl).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()

1 Answers1

0

here is a working version to do it:

first right click to show up the menu

menuDiv = browser.find_element_by_xpath("//<selector>']")
actionChains.move_to_element(menuDiv).perform()
actionChains.context_click().perform()

then locate the submenu item you want to click on

time.sleep(3)   //better wait for a little while
targetMenu = browser.find_element_by_xpath("//<selector>")
actionChains.click(targetMenu)
actionChains.perform()
LIU YUE
  • 1,593
  • 11
  • 19