FluidicML / browser-plugin

Workflow automation plugin.
https://www.fluidicml.com
MIT License
0 stars 0 forks source link

Multiple Tab Workflows #4

Open jrpotter opened 3 months ago

jrpotter commented 3 months ago

Is your feature request related to a problem? Please describe. Currently multiple tab workflows are not supported. We should support these.

Describe the solution you'd like By using the openerTabId and some strategic tab tracking, we should be able to reproduce multi-tab workflows. We could capture navigations automatically while a Recording action is active, add a "New Tab" option to the "Navigate" action, etc.

jrpotter commented 3 months ago

General thoughts as I start attempting to build this out:

Identifying how tabs and windows relate to one another is tricky (if not impossible). Suppose I start recording a tab and then I navigate to another tab and click on an element within its webpage. We need to somehow find a consistent way to identify which tab we should activate on replay. But what should happen if there are multiple tab candidate tabs with e.g. the same URL? What should happen if tabs aren't ordered consistently? Probably several more considerations to make.

Given the above complications, I think it makes sense to limit ourselves to handling the active tab when rextraction/injection/recording began as well as tabs opened during an active recording step. That is, 1) no longer allow extraction/injection/recording on multiple tabs unless 2) a tab/window was newly opened during an active extraction/injection/recording[^1]. We should be able to track new tabs by their URL (along with some concept of an "index"). If we were to pause and resume the recording, we can iterate through all recorded steps prior and continue allowing recording on any tabs we already recorded at least one interaction for.

[^1]: Typically we don't expect extraction/injection to open new windows since they don't interact with the page in any way. In JavaScript land though, anything could happen. For example, if a window/tab were to open on a timer, we should be able to track those (though we should also allow configuring how long we wait for elements).