4

i have some div that looks like this

<div class="someClassyStuff" on-tap="foo(param)"> Text </div>

within protractor we search and find the div element, check that the text matches our expectations, then call click() on that element. The test works fine in Chrome, but in IE it's as if no click happens.. breaking the test.

Does IE 11 support on-tap?

I've tried changing to ng-click="foo(param)" but with no effect.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Erik
  • 2,782
  • 3
  • 34
  • 64

4 Answers4

4

I solved this problem with these capabilities:

exports.config = {
    capabilities: {
        'browserName': 'internet explorer',
        'version': 11,
        'nativeEvents': false,
        'unexpectedAlertBehaviour': 'accept',
        'ignoreProtectedModeSettings': true,
        'enablePersistentHover': true,
        'disable-popup-blocking': true
    }
};

You can use the same in your browserstack setup:

exports.config = {
    capabilities: {
        'browser' : 'ie',
        'browserName': '',
        'browser_version' : '11',
        'os' : 'Windows',
        'os_version' : '7',
        'browserstack.user': 'XXX',
        'browserstack.key': 'XXX',
        'version': 11,
        'nativeEvents': false,
        'unexpectedAlertBehaviour': 'accept',
        'ignoreProtectedModeSettings': true,
        'enablePersistentHover': true,
        'disable-popup-blocking': true
    }
};

Found solution at Software Quality Assurance & Testing.

Nate Anderson
  • 18,334
  • 18
  • 100
  • 135
crashbus
  • 1,678
  • 18
  • 37
3

With automating IE browser, it's always something special. Try clicking the link "via javascript":

var elm = element(by.css("div.someClassyStuff"));
browser.executeScript("arguments[0].click();", elm.getWebElement());
Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • just finally ( I know) got around to trying this technique and unfortunately it appears to not change the situation. – Erik Sep 10 '15 at 18:47
1

I've had an issue like this where the click wouldn't click in firefox but it would in chrome. The workaround was to add mouse down and mouse up action after doing the initial click that worked in chrome.

browser.getCapabilities().then(function(cap){
    element(by.css("div.someClassyStuff")).click();
    if(cap.caps_.browserName == "ie"){
        browser.actions().mouseDown().mouseUp().perform();
    }
};

UPDATE:

the other ideas you could try if you haven't already:

(doing a double click)

element(by.css("div.someClassyStuff")).click().click(); 

the other thing I've used with tricky things to click is using the expected conditions to click on something

// Wait for an element to be clickable then click it
global.waitAndClick = function(element, time, errMessage) {
  if(typeof(time) ==='undefined') time = 10000;
  var IsClickable = EC.elementToBeClickable(element);
  browser.wait(IsClickable, time, errMessage);
  return element.click();
};

waitAndClick(element(by.css("div.someClassyStuff")), 5000, "failed to click my elem");
BarretV
  • 1,197
  • 7
  • 17
  • i notice you don't use a `.then()` .. is that on purpose or would it work in a `.then()` you think? – Erik Sep 10 '15 at 21:15
  • just tried this technique, with and without a promise. Doesn't seem to have had an effect. What bothers me is there's no real way for me to debug this without an error being thrown. Wondering if this is the IE driver's fault or not – Erik Sep 10 '15 at 21:20
1

I had a similar issue with IE, where no element could receive the click. The reason was that I had my global scaling in Windows set to >100% (Desktop > rclick > Display Settings). Apparently this caused IEDriver to click on the wrong coordinates.

The question doesn't specify if other elements can be clicked, but this might be the answer for other people with a similar issue.

Yuri
  • 21
  • 4
  • Could you rephrase this as an answer to the question? – mnwsmit Jun 16 '16 at 15:03
  • this is working for my situation. However, is there any other options other than changing the Windows settings? 100% on my laptop will cause the texts to be extremely small – DriLLFreAK100 Mar 13 '19 at 09:49