I'm trying to simulate contextClick action in latest firefox (my version is Mozilla Firefox 95.0.1) where ActionChains is deprecated. So currently using 'Actions' class and its methods for simulating the context click.
Here is my test code to simulate context click using pointer actions.
from marionette_driver.marionette import ActionSequence, Actions, Marionette
from marionette_driver.by import By
driver1 = Marionette()
driver1.start_session()
driver1.navigate("https://www.linkedin.com/")
element = driver1.find_element(By.LINK_TEXT, "Join now")
touchHandler = ActionSequence(driver1, "pointer", "mouse", {"pointerType":"mouse"})
touchHandler.pointer_move(0, 0, origin=element).pointer_down(button=2).pause(1500).pointer_up(button=2).perform()
touchHandler.pointer_move(10, 10, origin="viewport").pointer_down().pointer_up().pointer_down().pointer_up().perform()
Here, sending double click in order to
- quit the context menu first (
button=2
indicates right click, this triggers context click on particular element) - then it will deselect the element.
Problem is element got deselected in my case but the context menu exists always.
Not sure why the menu is not quitting though the element is deselected. Issue occurrence is 5/10 trials (not always)
Could you please help me on this issue ?