0

I am using protractor 3.0 with firefox 44 and chrome. My test passed when I use chrome, but some of my test (mostly the test involving select field) failed with firefox. I used this to retrieve the proper option

mySelect.element(by.cssContainingText('option', "Terminology")).click();

(I tried using this function and I had same result )

mySelect.all(by.css("option")).each(function(option){
            option.getText().then(function(text){
                if(text=="Terminology"){
                    option.click();
                }
            })
    });

Any idea about It ?

2 Answers2

1

Martin, try this and see what happens?

mySelect.element(by.cssContainingText('option', "Terminology")).click();
browser.actions().sendKeys( protractor.Key.ENTER ).perform();

If it does work then the cause might be because the model isnt being updated on the click call

TesterPhi
  • 346
  • 1
  • 12
  • thanks for the answer, I will try tomorrow at work :). I manage to do it using mySelect.sendKeys("Terminology"). So you are probably right – Martin SIMON Feb 10 '16 at 18:38
-1

Thank you TesterPhi

You solution is working on firefox however it failed with chrome.

But at the end the

mySelect.sendKeys("Terminology")

is working with both chrome and firefox,but I think is not a very good way to do it.

  • Yeah I agree its not a very good way to deal with it... https://www.bountysource.com/issues/1603443-calling-click-on-an-option-element-inside-a-select-doesn-t-update-the-model-in-firefox-only This is an interesting article which discusses the problem. I dont think there is of yet an ideal solution? – TesterPhi Feb 11 '16 at 08:52