Rayrun
← Back to Discord Forum

How to manage different tabs.

Hi team, I am using this code: <private async _goToPOIdetailsPage(newTabPromise = this.page.waitForEvent('popup')): Promise<Page> { await this.poiFirstRow.first().click() return await newTabPromise } >

And is working to work with a newTab, the thing is that I want to perform different actions in the newTab.

I am designing different method for each action I want to perform. The problem is that inside the method I call everytime this: _goToPOIdetailsPage

and the result I am getting is mutltiple tabs opened after the method is called.

This is how I do:

async updatePinValue() { const newTab = await this._goToPOIdetailsPage() const random = Math.floor(Math.random() * 9000 + 1000) const str: string = random.toString()

async deployToPOI() { const newTab = await this._goToPOIdetailsPage() await newTab.getByRole('button', { name: 'Deploy' }).click() aw...

how can I work just in only the 2nd tab I opened.

Example

I go to amazon, search for a product, open that product in a newTab and in the newTab I want to add more products, then switch the color and Finally add another product.

What I got is getting 3 tabs to do above 3 actions, and I want to do the 3 actions in just 1 tab.

Hope you can help me or guide me.

This thread is trying to answer question "How can I perform different actions in a new tab without opening multiple tabs?"

1 reply

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.