mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.19k stars 1.52k forks source link

Control + clicking a link should open new tab on Linux, not fire contextmenu event as on macOS #1492

Open mikael-s opened 5 years ago

mikael-s commented 5 years ago

System

Testcase

Here is a testcase using Python selenium

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get('https://fsf.org')
element = driver.find_element_by_link_text('Log in')
ActionChains(driver).key_down(Keys.CONTROL).click(element).key_up(Keys.CONTROL).perform()

Instead of a control+click performed on the link (which should open a new tab), the contextual menu is opened. I also tested with Firefox 57.0 (same geckodriver version) and it works as expected.

I have the same problem with Watir 6.

Trace-level log

1549387213450   Marionette      TRACE   0 -> [0,3,"WebDriver:FindElement",{"using":"link text","value":"Log in"}]
1549387213493   Marionette      TRACE   0 <- [1,3,null,{"value":{"element-6066-11e4-a52e-4f735466cecf":"c24cb21a-5075-4889-a4aa-6089f1540d9e","ELEMENT":"c24cb21a-5075-4889-a4aa-6089f1540d9e"}}]
1549387213493   webdriver::server       DEBUG   <- 200 OK {"value":{"element-6066-11e4-a52e-4f735466cecf":"c24cb21a-5075-4889-a4aa-6089f1540d9e"}}
1549387231220   webdriver::server       DEBUG   -> POST /session/9ce8cae0-0589-4fd7-b484-4035846a77d1/actions {"actions": [{"type": "pointer", "parameters": {"pointerType": "mouse"}, "id": "mouse", "actions": [{"type": "pause", "duration": 0}, {"type": "pointerMove", "duration": 250, "x": 0, "y": 0, "origin": {"element-6066-11e4-a52e-4f735466cecf": "c24cb21a-5075-4889-a4aa-6089f1540d9e"}}, {"type": "pointerDown", "duration": 0, "button": 0}, {"type": "pointerUp", "duration": 0, "button": 0}, {"type": "pause", "duration": 0}]}, {"type": "key", "id": "key", "actions": [{"type": "keyDown", "value": "\ue009"}, {"type": "pause", "duration": 0}, {"type": "pause", "duration": 0}, {"type": "pause", "duration": 0}, {"type": "keyUp", "value": "\ue009"}]}]}
1549387231224   Marionette      TRACE   0 -> [0,4,"WebDriver:PerformActions",{"actions":[{"actions":[{"duration":0,"type":"pause"},{"duration":250,"origin":{"element-6066 ... pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"type":"keyUp","value":""}],"id":"key","type":"key"}]}]
1549387231544   Marionette      TRACE   0 <- [1,4,null,{"value":null}]
1549387231557   webdriver::server       DEBUG   <- 200 OK {"value":null}
andreastt commented 5 years ago

This behaviour was changed in Firefox 62 and what you say, that Control + clicking on a link should open a new tab, seems to contradict https://bugzilla.mozilla.org/show_bug.cgi?id=1421323#c4, but aligns with what other users have reported in follow-up comments on the same bug:

The conclusion I draw from this is that Control + clicking a link should only open a context menu on macOS. I’ve filed https://bugzilla.mozilla.org/show_bug.cgi?id=1525338.

mikael-s commented 5 years ago

Actually the behaviour may be different from opening a new tab when clicking on a link. For instance I noticed the issue in a web application where ctrl+click is used to select several elements.

This behaviour was changed in Firefox 62

I only have this behaviour when Firefox is launched with Marionette. Otherwise with Firefox 62, ctrl+click has the usual behaviour.