I'm developping a basic firefox addon and I would like to test if a certain item is present in a context menu (displayed after a right click anywhere on the page).
I've seen that I could use marionette
and selenium-webdriver
but I can't find a way to click anywhere on the page and assert that a given item is present in the context menu.
I have a hard time simply right-clicking (not even talking about checking if the item is in the context menu...).
According to the documentation on ActionSequence
I should use click
and provide a right button click. I couldn't get it to work though. Here is what I've tried so far
const webdriver = require('selenium-webdriver');
const Capabilities = require('selenium-webdriver/lib/capabilities').Capabilities;
const input = require('selenium-webdriver/lib/input');
var capabilities = Capabilities.firefox();
capabilities.set('marionette', true);
var driver = new webdriver.Builder().withCapabilities(capabilities).build();
driver.get('http://localhost');
// Using a element for opt_elementOrButton
driver.actions().click(driver.findElement(webdriver.By.css('#changes')), input.Button.RIGHT).perform();
// Using right buttons
//driver.actions().click(input.Button.RIGHT, input.Button.RIGHT).perform();
// Using only one argument, as the second argument opt_button is "Ignored if a button is provided as the first argument"
//driver.actions().click(input.Button.RIGHT).perform();
//driver.quit();