Hello Nassim,
>>Is there any way to script pressing the combination key ctrl+t?
You can use the
Keys action of any Page object for this purpose:
Sub ChromeNewTab
' Open a new tab in Chrome
Call Sys.Process("chrome").Page("*").Keys("^t")
' Open a URL in the new tab
Call Sys.Process("chrome").ToUrl("http://smartbear.com/")
End Sub
>>What if I have more than one browser windows open?
In TestComplete, all pages opened in all browser windows of Google Chrome belong to one (main) process: Sys.Process("chrome"). To address a particular window displaying the needed URL, you simply need to refer to the corresponding Page object.
Suppose, we have two browser windows, one displaying
http://www.webkit.org/ and another displaying
http://www.google.com/ and we need to open a new tab in the first window. Then, the script would be:
Sub ChromeNewTab2
' Open a new tab in Chrome
Call Sys.Process("chrome").Page("http://www.webkit.org/").Keys("^t")
' Open a URL in the new tab
Call Sys.Process("chrome").ToUrl("http://smartbear.com/")
End Sub
Regards.