setContext

Boolean setContext(context)

Note: This function is deprecated unless you disabled tab support. Consider extending existing object names with a container property that refers to the browser tab where you want the lookup to happen. If you've used setContext to select a particular frame in a web page for object lookup, consider using the Boolean setFrameContext(browserTab, frameName) overload taking a browser tab and a context name.

This function makes the specified context the active window. This context is being used as the preferred window to look up object names. This means that all object lookups that follow this command will be executed in the context of the newly active window first and only if no object is found will the lookup continue in the other known contexts. A context string is a page's "base location"—this includes any parent locations necessary to precisely identify the page (for example, if the page is actually a frame or iframe element). The location for a window is created from the HTML (or php, jsp, asp) file that is loaded in the URL. So for example for "http://yourserver.com/path/to/file.html?parameter=value" the context would be just "file.html". If the URL of the window does not have a filename like "http://yourserver.com/path/?parameter=value" then Squish will simply assume the name "index.html" In addition there may be an number added to the context if there are multiple contexts with the same filename. This is done with angle brackets around the number, so if you have two windows open for the "file.html" page in the example above the second window would use "file.html<2>" as the context name. You can easily see what contexts Squish creates and expects for a given window by using HTML_Array contextList() function to access the known windows at any time and String contextOf(window) to retrieve their name. (See also, HTML_Array contextList(), String contextOf(window), String currentContext(), Boolean setFrameContext(browserTab, frameName), waitForContextExists(context).)

This function throws a catchable script error if the context name cannot be found. You can change this behavior using the ThrowErrorOnUnknownContextNames setting in the file etc/webwrapper.ini. If the setting is set to false this function simply returns true if the given frame context name could be found and activated and false otherwise.

© 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