Reputation: 2710
I'm using Protractor 2 and want to change the class attribute of a webElement
.
Pretend I have this menuWrapper
element which I need to append show
to its class attribute.
What is the easiest way to achieve this? Except for browser.executeScript()
.
Upvotes: 2
Views: 1359
Reputation: 473873
Selenium WebDriver specification (which WebDriverJS
and hence Protractor
follow/use) does not have anything documented for setting an element's attribute, only for getting an element's attribute. In other words, you won't find anything built-in for this task.
Certainly, the easiest way to set an element's attribute would be to use executeScript()
.
Upvotes: 3