import Component from './component.js'

export default class LinkComponent extends Component {
    /**
    * Expects the parent element and an xpath selector (without the leading slashes)
    * @param parent WebdriverIO.Element
    */
    constructor(parent, selector) {
        if (selector) {
            super(parent, selector);
        } else {
            super(parent, 'a');
        }
    }

    async href() {
        return await (await this.element()).getAttribute('href');
    }
}