У меня возникает ошибка при попытке выполнить приведенный ниже код:
import { test, expect} from '@playwright/test';
export class HomePage{
constructor(page){
this.page=page;
this.headerLabel='.app_logo';
this.product='//div[normalize-space()='${productName}']';
this.productList = '.inventory_item_name';
}
async checkHeaderLabel(){
await expect(await this.page.locator(this.headerLabel)).toContainText('Swag Labs');
}
async addToCart(productName){
const products = await this.page.$$(this.productList);
for(const product of products){
const option = await product.textContent();
if(option.includes(productName)){
await this.page.locator(this.product).click();
break;
}
}
}
}
Я получаю ошибку ниже:
SyntaxError: HomePage.js: Missing semicolon. (7:47)
> 7 | this.product='//div[normalizespace()='${productName}']';
| ^
Подробнее здесь: https://stackoverflow.com/questions/798 ... playwright