Problem with select tag in IE using Protractor

I have protractor tests working with Selenium using IEDriverServer (32 bit). I have several problems with tags <select>that do not click and do not reveal their parameters.

Here is my conf.js:

exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.
multiCapabilities: [
    {
        browserName: 'internet explorer',
        ignoreProtectedModeSettings: true,
        ignoreZoomSetting: true,
        nativeEvents: false
    }
    //,
    //{
    //    browserName: 'chrome'
    //}
],
baseUrl: String(process.env.COMPUTERNAME.toLowerCase()) === String('build') ? 'http://dev/' : 'http://' + process.env.COMPUTERNAME + '/',

// can use 'suites' instead of 'specs' - check api documentation
suites: {
    dashboard: 'dashboard/myCallbacksWidget_spec.js',
    employees: 'employees/employees_spec.js',
    lead: 'lead/lead_spec.js',
},

// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 80000
},

allScriptsTimeout: 80000,

onPrepare: function () {

    browser.driver.manage().window().maximize();

    if (process.env.TEAMCITY_VERSION) {
        require('jasmine-reporters');
        jasmine.getEnv().addReporter(new jasmine.TeamcityReporter());
    };
    //var ScreenShotReporter = require('protractor-screenshot-reporter');
    var ScreenShotReporter = require('protractor-html-screenshot-reporter');
    var path = require('path');
    jasmine.getEnv().addReporter(new ScreenShotReporter({
        baseDirectory: 'tmp/report',
        pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) {
            return descriptions.join('-');
        }
        //takeScreenShotsOnlyForFailedSpecs: true
    }));
   }
};

Here is my test:

describe('Lead Details Test', function () {
var arrowDown = '\uE015';

it('should open the first lead', function () {
    browser.get('Slate.Iva/#/search-leads');

    var firstItem = element(by.repeater('row in renderedRows').row(0));
    firstItem.evaluate('onDblClickRow(row)');

    expect(element(by.id('leadName')).isPresent()).toBe(true);
});

it('should select reason for difficulty', function () {
    var reasonForDifficulty = element(by.id('reasonForDifficultySelect'));
    expect(reasonForDifficulty.isPresent()).toBe(true);
    reasonForDifficulty.click().sendKeys(arrowDown).sendKeys(protractor.Key.ENTER);

    var saveButton = element(by.id('saveLead'));
    saveButton.click();

    browser.refresh();

    var firstOption = element.all(by.options('item.id as item.name for item in leadData.reasonForDifficultyTypes')).first();
    expect(firstOption.getText()).toEqual('Cosmetic Surgery');
  });
});

When I do reasonForDifficulty.click(), it highlights <select>, but sendKeys don't seem to work.

This code works if it <select>is a drop down list.

I am using Protractor 2.0.0, Selenium 2.45.0 and IEDriverServer 2.45.0.0. I also work on Windows 8.1 and have IE11.

Is there a workaround for this, or am I missing something in my code?

+4
source share
1 answer

:

var value = 'It was too difficult';
reasonForDifficulty.element(by.cssContainingText('option', value)).click();

" ", , .

, ,

 var optionNum = 5
 var options = reasonForDifficulty.all(by.tagName('option'))
    .then(function(options){
      options[optionNum].click();
    });

6- ( , , ) , , , , , , ( ).

+1

All Articles