opensea-uploader icon indicating copy to clipboard operation
opensea-uploader copied to clipboard

How to add custom properties

Open arabold opened this issue 3 years ago • 0 comments

Adding custom properties to OpenSea assets is a bit tricky, as it involves popup dialogs and dynamic input forms. However, the code below might be of some help. Append these lines to your fillFields function:

  // Add properties
  const addPropertiesButton = await page.$('button[aria-label="Add properties"]');
  await addPropertiesButton.click();

  // Add 2 more properties for a total of 3
  const addMoreButton = await page.$('button.gIDfxn');
  await addMoreButton.click();
  await page.waitForTimeout(100);
  await addMoreButton.click();
  await page.waitForTimeout(100);

  // Select all input fields
  const propertyNames = await page.$$('input[placeholder="Character"]');
  const propertyValues = await page.$$('input[placeholder="Male"]');

  await propertyNames[0].type('Class');
  await propertyValues[0].type(`Hunter`);

  await propertyNames[1].type('Race');
  await propertyValues[1].type(`Elf`);

  await propertyNames[2].type('Gender');
  await propertyValues[2].type(`Female`);

  const saveButton = await page.$x('//button[contains(., "Save")]');
  await saveButton[0].click();

Good luck! 👍

arabold avatar Jan 19 '22 00:01 arabold