Getting a Dynamic Element by Selector
You can match the beginning and end of the id
attribute using:
await page.click('[id^="product-"][id$="-Size"]');
Or, more accurately, you can ensure that a number is present in the middle of your id
using regex:
await page.evaluate(() => {
[...document.querySelectorAll('[id^="product-"][id$="-Size"]')].filter(e => e.id.match(/^product-\d+-Size$/g))[0].click();
});
You may use attribute starts with selector to do that:
page.click('button[id^="product-"]')