Controlling Multiple Browsers

As you’ve seen, UBot Studio gives you a lot of power in one browser. But you know what’s better than one browser? More than one browser. The reasons for this are many. You might want to load a page in one browser, load another page in another browser, and compare the two. You might want to update information on one page based on information from another page. You might want to open a few pages in multiple threads – either way, UBot Studio has got you covered with commands that let you control multiple browsers as easily as you can control one.

 

To start, the in new browser command creates a new browser instance when the command fires, and closes the browser instance when it finishes. All the browser commands that run inside it will be executed in the new browser instance. Here’s a gif of what that looks like:

 

innewbrow

It’s important to note that in new browser will give you a browser with all new cookies, clean cache, etc. That means that if you’re logged into a website, you will no longer be logged in with the new browser.

 

If you need to share cookies across the separate browsers, you want the in shared browser command. in shared browser works in the same way that in new browser works, but it will share the cookie sessions. That means that if you’re logged into a website, you will still be logged in with the new browser, as long as you use in shared browser.

 

Finally, we have the in popup command. This command works a little differently. Instead of opening a new browser, it looks for a recently loaded popup. This means that your main bot will need to do something that results in a popup loading, and then in popup can spring into action. All of the browser commands inside in popup will be executed inside the popup browser. Here’s code for that:

allow popups(“In New Window”)
navigate(“http://www.javascript-coder.com/files/window-popup/javascript-window-open-example1.html”,”Wait”)
click(<href=”javascript: openwindow()”>,”Left Click”,”No”)
wait(4)
in popup {
    wait for element($element offset(<class=”menu_control”>,0),””,”Appear”)
    set(#header,$scrape attribute(<href=w”http://www.javascript-coder.com/jsform/*”>,”href”),”Global”)
    close page
}

And that’s it. Just 3 commands that let you control an army of browsers, each running separate tasks, bring you closer and closer to you goal. Which, I assume, is to download and categorize every cat picture on the internet. Good Luck.