Mosselman
Mosselman

Reputation: 1748

Protractor test for Ionic framework modal click not working

I am building an app with Ionicframework in which I have a modal with a list of directives. I am now writing some protractor E2E tests and all was going well until I had to click on one of the directives.

The error I get is:

UnknownError: unknown error: Element is not clickable at point (185, 212). Other element would receive the click: <div class="modal-backdrop active">...</div>

This could have something to do with the animation of the modal sliding in, so I found this 'solution':

it 'is very annoying', ->
  members = element.all(By.css('member')) # The directives are: <member >
  EC = protractor.ExpectedConditions

  if members.first()
    browser.wait(EC.elementToBeClickable(members.first()), 5000).then ->
      element.all(By.css('member')).each (member) ->
        member.click()

I still get the error however.

'Tricks' like browser.sleep(2000) have also not worked so far.

Does anyone know how I can get it to work?

Upvotes: 2

Views: 521

Answers (1)

Mosselman
Mosselman

Reputation: 1748

As always when asking a question like this you are forced to cut down everything to the basics and start thinking out of the box (at least your own box).

The solution:

element(By.cssContainingText('member .member-name', "Mark Twain")).click()

This is because Angular pops-out a div from the directive and binds all events on this. .member-name is a p inside of the member and clicking that apparently does the trick.

:)

Upvotes: 3

Related Questions