attachToBrowser

attachToBrowser(portOrWindowTitle)

This function allows connecting Squish for Web to an already running instance of the browser selected in the server configuration. This can be used in cases where the browser should not be started by Squish itself but is rather started by some other program that is being automated as part of the test. The portOrWindowTitle is required for most supported browsers and specifies how to find the instance of the browser that Squish should connect to. The example code below shows which browsers use the parameter and what type of value is to be provided. When specifying a number it has to match the communication port number configured during the installation of the browser extensions.

When the portOrWindowTitle is a string it needs to match the window title of an existing browser window. The window title pattern can use wildcards to allow connecting to a window where some parts of the title are changing. (* matches any number of characters, ? matches any single character). The wildcard must however be specified in such a way that only a single browser window is being identified. The window title is usually the title of the active tab of the browser and it can usually be obtained from the tooltip when hovering over the entry of that window in the task bar.

See Attaching to a running Web Browser for a more complete introduction how to use this feature.

function main() {
  // Firefox (for Chrome use 9935)
  attachToBrowser( 9932 );
  // Internet Explorer
  // attachToBrowser( "*Automated Cross-Platform GUI Testing" );
  // Safari
  // attachToBrowser();
}
sub main {
  # Firefox (for Chrome use 9935)
  attachToBrowser( 9932 );
  # Internet Explorer
  # attachToBrowser( "*Automated Cross-Platform GUI Testing" );
  # Safari
  # attachToBrowser();
}
def main():
  # Firefox (for Chrome use 9935)
  attachToBrowser( 9932 )
  # Internet Explorer
  # attachToBrowser( "*Automated Cross-Platform GUI Testing" )
  # Safari
  # attachToBrowser()
def main()
  # Firefox (for Chrome use 9935)
  attachToBrowser( 9932 )
  # Internet Explorer
  # attachToBrowser( "*Automated Cross-Platform GUI Testing" )
  # Safari
  # attachToBrowser()
end
proc main {} {
  # Firefox (for Chrome use 9935)
  invoke attachToBrowser 9932
  # Internet Explorer
  # invoke attachToBrowser "*Automated Cross-Platform GUI Testing"
  # Safari
  # invoke attachToBrowser
}

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results