How to Navigate Context Menus (Selenium, Python) -
i aware selenium apparently doesn't support navigating context menus. have seen in several other threads there work-around using action chains. using context_click()
followed arrow key commands navigate through menus.
all examples i've seen have used java, , when translated python, context_click()
command register. strangely enough, wouldn't error either. other sources have said context menus selenium produces system level, , thus, selenium cannot touch them, create.
so question is, has been able navigate , chose options context menus through selenium? python examples preferred, i'll take advice or answers can get.
edit:
code:
driver.get('https://www.google.com/') actionchains = actionchains(driver) actionchains.context_click().send_keys(keys.arrow_up).send_keys(keys.enter).perform()
context:
this test script have been running test situation. in personal project, need navigate context menu access chrome extension. since selenium can interact within web page can't have click on button chrome extension displayed browser. work-around have been attempting.
research:
https://testingrepository.com/how-to-right-click-using-selenium-webdriver/ - source tells seleniums context menus system level. in java examples use .build()
command. far knowledge, command not available python.
select option right-click menu in selenium webdriver - java - thread suggesting arrow key commands should work. however, examples use java , .build()
command well
https://github.com/seleniumhq/selenium/blob/master/py/selenium/webdriver/common/action_chains.py - shows actionchains()
pythons's version of .build()
command. might common knowledge some. did not know prior.
how perform right click using selenium chromedriver? - similar question mine. while 1 user suggests menu cannot interacted with, suggests actionchains work-around work.
thin,
i had same problem , wonder nobody answered already... wasn't possible me solve selenium, cause selenium navigate within page. solution:
import win32com.client comclt wsh= comclt.dispatch("wscript.shell") actionchains(driver).move_to_element(element).context_click().perform() wsh.sendkeys("{down}") # send keys want
Comments
Post a Comment