Parallel For Each Help

I am working on a project that will execute a series of clicks on a website. It works perfectly right now on one tab, but the problem is that there is a lot of waiting for things to process, load, etc. I’d love to be able to streamline this and adjust the code to open a new tab if the bot is waiting to perform the next step due to an element not being visible yet, so I was looking into Parallel For Each with possibly just closing the tab when execution “completes” on one tab, and opening a fresh tab for the start of every thread.

Is anyone able to help guide me or provide even a basic Parallel For Each structure that would operate on two tabs with identical URLs, switching between them as needed, to interact with UI elements appropriately? Is it even possible?

@jlpath

Parallel is generally used to process on one tab but not on multiple tabs at the same time…

Cheers

Hi

I think you can achieve a similar outcome by using multiple browser windows instead of tabs

It’s important to note that web automation can still be challenging to synchronize across multiple browser windows, as web pages may have their own timing and loading variations

But still u can give a try by using appropriate waiting mechanisms to ensure reliable automation with activities like “Element Exists” or "Wait Element Vanish

Something like this

Open Browser (Browser1) to URL
Open Browser (Browser2) to URL

Parallel For Each (Action in Actions)
If Action requires Browser1
Perform Action in Browser1
Close Browser (Browser1)
Else If Action requires Browser2
Perform Action in Browser2
Close Browser (Browser2)
End Parallel For Each

Hope this helps

Cheers @jlpath