Hey Joma,
(Philipp writing - we’ve just been in touch via email) Here’s an example workflow which sets a random user agent string taken from a given list within each loop iteration. To verify that it works, it will take a screenshot of a whatsmyuseragent page.
The key parts:
-
Ensure that the capabilities get recreated upon each loop iteration by moving them into the loop.
-
To set the capabilities dynamically, you can pass them as flow variable as JSON-encoded string. This is what the Java Edit Variable node is doing. The Capabilities JSON for a Chrome browser looks like this for example:
{"chromeOptions":{"args":["--user-agent=Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 Safari/537.36 LBBROWSER "]}}
If you’d rather assign the UAs in a deterministic way, @HansS’s solution is the way to go!
By the way, instead of manually curating the UA list, if you would like this more dynamic, this could be extended to pull UA strings from a source like this using Palladian’s HTTP Retriever.
You can download the workflow from my NodePit Space:
Hope that helps!
Best regards,
Philipp