jeudi 12 septembre 2019

Ruby Watir : How can i switch between tabs on a Chrome window, focus and work on both of them, or switch between to window browser of Chrome?

I want to make a automation script that switches between 2 tabs of Chrome and focus on them or i have tried to open 2 different Chrome browser windows but i can focus on second one and then focus on the first one.

require 'watir'

browser = Watir::Browser.new :chrome
browser.goto "https://google.com/"
sleep(5)

I can open a new tab using execute_script but i can not focus and then switch again to the first tab

browser.execute_script('window.open("www.facebook.com")')

Aucun commentaire:

Enregistrer un commentaire