Web testing

QF-Test supports several browsers and is able to control them so that users can record manual interactions with the browser and replay those actions again. To gain full control over the browser QF-Test uses two different approaches which will be explained in the following sections.

Note Both approaches are necessary and they will continue to coexist and be fully maintained. Most browsers can be accessed by only one of the two, the only exceptions are Chrome on Windows and Firefox up to version 43 on Windows and Linux. QF-Test attempts to do the right thing by default but you can take control via the attribute 'Browser connection mode' of the 'Start web engine' node.

Web testing using QF-Driver connection mode

This approach integrates the locally installed browser into a wrapper-window. This approach is also called embedding. QF-Test natively embeds the browser into its own window, thus gaining access to its automation-interfaces. By using these interfaces QF-Test can listen for events from the browser and is also able to inject events the other way into the browser.

Native embedding of browsers into a separate window is not working satisfactorily for newer browsers and in case of Microsoft Edge this approach cannot work at all. For this reason an alternative mechanism was implemented in QF-Test 4.1. Explanations on this mechanism can be found in the following section.

Website Testing using WebDriver

4.1+ Given that the existing approach using embedding is not maintained anymore by some browser vendors or is not supported at all, a new mechanism was implemented for QF-Test 4.1 to support future browsers and browser versions. This mechanism uses Selenium WebDriver as a bridge between the browser and QF-Test.

Note The WebDriver connection mode is not yet on par with QF-Driver mode in terms of performance and feature completeness (see subsection 14.2.4). When recording, events may get lost. For the time being we recommend to primarily use QF-Driver mode for recording. Please see the system requirements in section 1.1 for detailed information about which browsers are supported for each connection mode and operating system.

WebDriver in general

WebDriver is slowly evolving into a W3C-standard for interacting with web browsers. ( WebDriver is a remote control interface that enables introspection and control of browsers, based on a platform and language-neutral wire protocol.

The various browser vendors have agreed on this quasi-standard, so that the WebDriver integration is partly implemented directly by the vendors themselves. Partially the integration is based on plugins, some vendors already include the integration in the default setup of their browsers.

QF-Test uses the WebDriver interfaces to interact with the browser. Since the WebDriver approach is only partially fitting the concepts of QF-Test, its web engine was extended so that most of QF-Test's functionality is also available via WebDriver, including the added benefits like synchronization, abstraction of components etc.

Moreover the QF-Test approach can be combined with already existing Selenium scripts. When using WebDriver mode QF-Test is able to directly execute those in an 'SUT script' node (see section 45.2).

Note If you use the WebDriver mode, you are no longer limited to Firefox if you want to specify a browser installation folder using the attribute 'Directory of browser installation' of the 'Start web engine' node. If no matching browser can be localized in the specified directory, an exception will be thrown. If no directory is specified, QF-Test will try to start a default browser of the given browser type.

Note QF-Test needs to deep inspect the browser content in order to enable the familiar testing features (e.g. event and check recording, feature based component recognition, web and custom resolvers) in WebDriver mode. This might provoke in some browsers a warning based on mixed content display or an untrusted certificate. If this warning or error message only appears while running the web site in testing mode, you can safely ignore it.

WebDriver with Microsoft Edge (until Edge Version 44)

Because Microsoft Edge comes without pre-installed WebDriver support, the WebDriver integration needs to be installed manually once.

On Windows 10 1809 and 1903, the Microsoft WebDriver is a so called "Feature on Demand". Navigate to "Windows-Settings > Apps > Apps & features > Manage optional features and installing" and add the "Microsoft WebDriver" as new feature (Alternatively, run the following in an elevated command prompt: DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~ On older Systems (up to Windows 10-1803) navigate your web browser to the Microsoft WebDriver website and download and install the WebDriver version matching your operating system.

In addition, a loopback exemption needs to be defined for the Edge browser. Windows 10 uses an isolation technology that may prevent requests being sent from Edge to QF-Test. Although this does not always happen, we recommend enabling the loopback before testing with Microsoft Edge.

To enable loopback for Edge, open a command shell with administration rights and execute:

CheckNetIsolation LoopbackExempt -a -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

To disable loopback for Edge, open a command shell with administration rights and execute:

CheckNetIsolation LoopbackExempt -d -n="Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

Details about for enabling loopback for Windows apps can be found in the Windows Dev Center.

After successful installation you can also use Microsoft Edge as browser in your tests.

WebDriver with Safari

To run tests with Safari, macOS 10.11 or newer and Safari 10 or newer are required. In addition, a setup has to be performed to oactivate the browser automation: Open the Safari Preferences and select "Show Develop menu in menu bar". In this menu, activate the "Allow Remote Automation" option. After that, open a Terminal window and execute once the command /usr/bin/safaridriver -p 0 to authorize the driver.

Note Due to special security restrictions imposed by the Apple SafariDriver, the interaction between QF-Test and Safari is limited in the following ways:

  • Tests can only be replayed but not recorded
  • No hard events are possible
  • Only one browser instance is allowed
Known limitations of the WebDriver mode

The WebDriver connection mode is under active development. Due to this, some features known from QF-Driver connection mode are not yet available, mostly due to restrictions of the WebDriver specification.

  • No support of file downloads and HTTP authentication.
  • It is not possible to record or replay HTTP requests directly.
  • wd.getComponent(WebElement) does not work currently on elements in inner frames.
  • Events triggering a page load are sometimes not recorded.
  • Event-Synchronization is in some cases delayed.
Web-Tests without visible Window

4.2+ Using the WebDriver-connection-mode it is possible to drive Firefox and Chrome in the so called "headless"-mode. In this mode, the browser is started in the background, but without any visible window on the screen. All interactions with the web page are executed inside this "invisible" window.

To execute an existing web test using the "headless"-mode, simply change the type of browser in the 'Start web engine' step from chrome to headless-chrome or from firefox to headless-firefox. Please note that the "headless"-mode is only supported since Chrome 60 and Firefox 57.

Emulation of mobile Browsers

4.2.1+ An important aspect of web page testing is the user experience on mobile devices like smartphones or tablets, since due to varying browser identifiers ("user agent") and device-specific screen sizes rendering of web pages differs between mobile and desktop browsers ("responsive design").

QF-Test supports such scenarios by emulating mobile browsers: A desktop browser (e.g. Google Chrome) is started in a special mode, where the page size and the browser identifier mimics those of browsers on mobile devices. In addition, Google Chrome simulates specific characteristics of mobile browsers like varying pixel ratios or the automatic scaling of non-responsive web pages.

To use mobile emulation in QF-Test, select the corresponding entry in the quickstart assistant (see chapter 3) and specify the required device parameters, together with the URL of the web page and additional test requirements. QF-Test ships with a great number of predefined definitions of well-known mobile devices, which can be freely adapted as needed.