Skip to main content

Hi Team,

I am performing the following steps and the screenshot is attached.Unable to execute last 4 lines of code

1. New tab opens

2. Search 'Users' in left search box using suggestive search and click 'Users' at end of list.

3. List of Names Open on the same page.

4. Click on 'B' 

I have used timeout and waitfor functions but still the test doesn't execute step 4 above (which is the last 4 lines of code below after the break statement).

  const [newpage] = await Promise.all(    [    context.waitForEvent('page'),    setupbutton.click(),    ])  const quickfind = newpage.locator("[placeholder*= 'Quick Find']");  const options = newpage.locator(".slds-tree_container");  await quickfind.pressSequentially("Users",{delay:100});  await options.waitFor();  const optionscount = await options.locator(".slds-tree__item-label").count();    for(let i=0; i< optionscount; ++i)    {       const text = await options.locator(".slds-tree__item-label").nth(i).textContent();       if(text === "Users")       {        const Usersbutton = options.locator(".slds-tree__item-label").nth(i);        await Usersbutton.click();        break;       }    }    await newpage.waitForTimeout(8000);    const link = newpage.getByRole('link', { name: 'B', exact: true }).first();    await link.waitFor();    await link.click();

 

I have also tried using Frame ID logic where the frameId is dynamic and keeps changing on every refresh. The below piece of code: But nothing helps. Please advise!

 const dynamicFrameName = 'vfFrameId_'; const frameSelector = newpage.frameLocator(`iframe[name^="${dynamicFrameName}\\d+"]`); const iframe = await frameSelector.waitForSelector('a', { state: 'attached', timeout: 10000 }); const iframeElement = iframe.frame(); const link = await iframeElement.locator('a').withText('B').first(); await link.click();

 

#Salesforce Developer@* Salesforce Developers *

1 Antwort
0/9000