verbal-limeV
Apify & Crawlee4y ago
4 replies
verbal-lime

how to handle variable selectors on pages to scrapped ?

hi i am attempting to run code using apify playwright crawler, attempting to scrape using selectors, the issue is not all pages have same selectors. some page have 2 selectors some have 3, how do i manage that, the code i am using is :
    const currentInvestingPosition = await page.locator('//*[@id="vc-profile"]/div/div[2]/div[2]/div[2]').innerHTML();
    const investmentRange = await page.locator('//*[@id="vc-profile"]/div/div[2]/div[2]/div[3]').innerHTML();
    const sweetSpot = await page.locator('//*[@id="vc-profile"]/div/div[2]/div[2]/div[4]').innerHTML();
    const investmentsOnRecord = await page.locator('//*[@id="vc-profile"]/div/div[2]/div[2]/div[5]').innerHTML();
    const currentFundSize = await page.locator('//*[@id="vc-profile"]/div/div[2]/div[2]/div[6]').innerHTML();
Was this page helpful?