exports.ContentPage= class ContentPage { constructor(page) { this.page = page; this.contentButton="//span[normalize-space()='Content']"; this.contentToEdit="//select[@id='select_content_to_edit']"; this.contentPageValidate="//h1[normalize-space()='Content Editor']"; this.contentText="//div[@class='CodeMirror-scroll']"; this.contentSave="//button[normalize-space()='Save']"; } async clickContentButton(){ await this.page.locator(this.contentButton).click(); } async ContentToSave(contentToEditOption){ await this.page.locator(this.contentButton).click(); await this.page.locator(this.contentToEdit).selectOption({label:contentToEditOption}); //await this.page.locator(this.contentText).fill(mainContent); await this.page.waitForSelector('.CodeMirror'); await this.page.evaluate(() => { const codeMirrorElement = document.querySelector('.CodeMirror'); codeMirrorElement.CodeMirror.setValue('Everything goes good'); }); await this.page.locator(this.contentSave).click(); } }