1

I 'm testing an Angular JS site with protractor and Appium, Recorder details. The click into the login button isn't working as i have mentionned here The problem with click().

  • Is it possible that because visible = false from inspector details?

  • In that case how can i change the visibility of a button into true ?

  • I get true with that code :

loginbutton.isDisplayed().then(function(result){ console.log(result); });

Community
  • 1
  • 1
Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77
  • 1
    Related: http://stackoverflow.com/questions/22265040/how-to-click-on-hidden-element-in-protractor. – alecxe May 02 '16 at 13:11

2 Answers2

1

I believe you can change any attributes using native Javascript. Protractor can run JavaScript in context of some element. Take a look here.

So the answer probably would be like this:

browser
.executeScript("document.querySelector(<yourElementSelectionPath>).setAttribute('visible', 'true')");
zmii
  • 4,123
  • 3
  • 40
  • 64
  • Thanks for your answer, i will try it :) but instead of document what shall i put ? – Emna Ayadi May 02 '16 at 11:25
  • sorry. you need to put the argument into quotes. everything should work then. Try now. – zmii May 02 '16 at 11:26
  • try to query something simple first. like `document.querySelector("body")` and then print it (add `.then(function(data){console.log(data);})`) – zmii May 02 '16 at 11:37
  • DOM exception 12 isn't there anymore – Emna Ayadi May 02 '16 at 11:46
  • try to find your element in browser console using this `document.querySelector` syntax, maybe you don't find it properly. – zmii May 02 '16 at 11:50
  • The problem may be in html code i have and in appium visible=false, shall i use clicked instead? i'm sure about the elt location, because i use it before of the button – Emna Ayadi May 02 '16 at 11:52
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/110827/discussion-between-zmii-and-emna). – zmii May 02 '16 at 11:52
0

This was not the origin problem that the click into login button isn't done as i have expected, i solved it by changing the way when clicking into a button in protractor by this way :

browser.actions().mouseMove(loginButton).click().perform();

Here the Origin of the problem.

Hope that this help you.

Emna Ayadi
  • 2,430
  • 8
  • 37
  • 77