Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const stampit = require('stampit');
const { pipe, split, includes } = require('ramda');
const { isFunction } = require('ramda-adjunct');
const WebElementEnhanced = stampit
.props({
webElement: null,
})
.init(function ({ webElement }) {
this.webElement = webElement;
})
.methods({
async containsClassName(className) {
const classList = await this.webElement.getAttribute('class');
return pipe(split(' '), includes(className))(classList);
},
async containsText(text) {
const elementText = await this.webElement.getText();
return includes(text, elementText);