jeudi 28 juin 2018

Unable to assert css width to be 100%

I'm trying to assert the CSS width of an element in NightwatchJS to be 100%, but it fails saying that the width is 196px. I have tried using the following syntaxes for the same:

page.assert.cssProperty(`@button-element`, 'width', '100%');
page.expect.element(`@${element}`).to.have.css("width").which.equals("100%");

I don't want to use hard-coded values, as they can change depending on the container width. What is the right way to do it?

I am using Page Object Model here but can do without it.

Aucun commentaire:

Enregistrer un commentaire