switchTo
Allows switching between tabs and windows using URL or page title or Window name.
Examples
# Switch using URL
await switchTo(/taiko.dev/)
# Switch using Title
await switchTo(/Taiko/)
# Switch using Regex URL
await switchTo(/http(s?):\/\/(www?).google.(com|co.in|co.uk)/)
# Switch using wild cards in the Regex
await switchTo(/Go*gle/)
# Switch to a window identifier
await openBrowser();
await goto('google.com');
openIncognitoWindow({ name: "newyorktimes"});
switchTo(/google.com/);
switchTo({ name: "newyorktimes"});
openTab('https://taiko.dev', {name: 'taiko'})
openIncognitoWindow({ name: "newyorktimes"});
switchTo({name: 'taiko'});
Parameters
-
arg
-
Regex (Regular expression) the tab's title/URL or
Object
with window name for example{ name: "windowname"}
Returns
Promise<void>