protractor icon indicating copy to clipboard operation
protractor copied to clipboard

browser.actions()._ HTTP method not allowed

Open gultyayev opened this issue 7 years ago • 9 comments

Bug report

  • Node Version: 12.13.0
  • Protractor Version: 5.4.0
  • Angular Version: 8.2.13
  • Browser(s): Chrome (78.0.3904.70), FireFox (70.0)
  • Operating System and Version Ubuntu 19.04
  • Your protractor configuration file
const { SpecReporter } = require('jasmine-spec-reporter');
const HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
const path = require('path');

const screenshotReporter = new HtmlScreenshotReporter({
    dest: path.join(__dirname, '../../../e2e-report/public'),
    filename: 'public.html'
});

exports.config = {
    allScriptsTimeout: 11000,
    specs: [
        './src/**/*.e2e-spec.ts'
    ],
    multiCapabilities: [
        {
            'browserName': 'chrome',
            chromeOptions: {
                args: [
                    '--window-size=1980,1020',
                    '--headless'
                ]
            }
        },
        {
            'browserName': 'firefox',
            firefoxOptions: {
                args: [
                    '--window-size=1980,1020',
                    '--headless'
                ]
            },
            'moz:firefoxOptions': {
                args: [
                    '--window-size=1980,1020',
                    '--headless'
                ]
            }
        },
    ],
    directConnect: true,
    baseUrl: 'http://localhost:4200/',
    framework: 'jasmine',
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 30000,
        print: function() {
        }
    },
    beforeLaunch() {
        return new Promise(resolve => {
            screenshotReporter.beforeLaunch(resolve);
        });
    },
    async onPrepare() {
        require('ts-node').register({
            project: path.join(__dirname, './tsconfig.json')
        });
        protractor.browser.waitForAngularEnabled(false);
        jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
        jasmine.getEnv().addReporter(screenshotReporter);
    },
    afterLaunch(exitCode) {
        return new Promise(resolve => {
            screenshotReporter.afterLaunch(resolve.bind(this, exitCode));
        });
    },
    SELENIUM_PROMISE_MANAGER: false
};

The problem is that I run same tests on Chrome and Firefox, however in Firefox it errors

Failed: HTTP method not allowed WebDriverError: HTTP method not allowed

And this is the code where it failed

export async function dragAndDrop(el: ElementFinder, target: ElementFinder) {
    await browser.actions().mouseMove(el).perform();
    await browser.actions().mouseDown().perform();
    await browser.actions().mouseMove(target).perform();
    return browser.actions().mouseUp().perform();
}

gultyayev avatar Oct 31 '19 12:10 gultyayev

Hi, @gultyaev ! Take a look at https://github.com/angular/protractor/issues/4687 , https://github.com/angular/protractor/issues/4177

IgorSasovets avatar Nov 20 '19 15:11 IgorSasovets

@juliemr any solution for this i am also getting same error.

vickyru avatar Dec 11 '19 07:12 vickyru

Any solution for the same? for cross-browser with "multicapabilities", the test was working fine with chrome but the browser.actions is failing with firefox, please help.

WebDriverError: HTTP method not allowed

mdirfanmustafa avatar Feb 18 '20 05:02 mdirfanmustafa

Any update on this? Happening in firefox.

  • Failed: HTTP method not allowed

dev-it-new avatar Jan 15 '21 15:01 dev-it-new

Would greatly appreciate if this got fixed so that we can use firefox with the new dynamic grid https://github.com/SeleniumHQ/docker-selenium#dynamic-grid-

mrkjdy avatar Feb 15 '21 15:02 mrkjdy

still no fix?

WhyINeedToFillUsername avatar Mar 07 '21 22:03 WhyINeedToFillUsername

Any help on this bug? Facing this problem using firefox with grid. Failed: HTTP method not allowed

ashishgoel88 avatar Mar 22 '21 13:03 ashishgoel88

@ashishgoel88 see my comment on SO https://stackoverflow.com/a/66530395/4255158, might help you. It worked for me :)

WhyINeedToFillUsername avatar Mar 22 '21 15:03 WhyINeedToFillUsername

@WhyINeedToFillUsername Your solution didnt work on mouse actions. I would like to perform right click on the element on firefox. browser.element(by.css('locatorname')).sendKeys(protractor.Button.RIGHT); It does not give any error on this, but also it does not even perform the action. On Chrome, I was able to fix it with the help of w3c config and perform click by using browser.actions.

Thank you for feed back anyways.

ashishgoel88 avatar Mar 24 '21 09:03 ashishgoel88