Selenium WebDriver Plugin/en: Unterschied zwischen den Versionen
Cg (Diskussion | Beiträge) |
Cg (Diskussion | Beiträge) |
||
Zeile 10: | Zeile 10: | ||
In some cases, expecco may show a warning, that the driver version could be incompatible with the browser. This does not mean per se, that the combination does not work; instead, it means that the combination has not been tested by eXept, but may nevertheless work. If such a warning is shown, check the "''Do not show this warning again''" toggle, to have expecco remember that combination as "trusted" in your settings. |
In some cases, expecco may show a warning, that the driver version could be incompatible with the browser. This does not mean per se, that the combination does not work; instead, it means that the combination has not been tested by eXept, but may nevertheless work. If such a warning is shown, check the "''Do not show this warning again''" toggle, to have expecco remember that combination as "trusted" in your settings. |
||
You find new driver versions at following addresses: |
You find new driver versions at the following addresses: |
||
{| |
{| |
||
|Chrome/Chromium |
|Chrome/Chromium |
Version vom 19. Juni 2018, 20:27 Uhr
Inhaltsverzeichnis
Introduction[Bearbeiten]
You can use the Selenium WebDriver Plugin to create webtests. The plugin can be (and usually is) used with the GUI Browser, which supports the creation of tests. Moreover, it allows the recording of test runs.
The Selenium WebDriver Plugin replaces the previous Selenium Web Test Plugin, which was based on the now outdated Selenium RC interface.
The new web driver uses the Selenium WebDriver for automation, and replaces the previous interface.
Browser Support[Bearbeiten]
This plugin supports (among others) the Chrome/Chromium, Edge, Firefox and Internet Explorer browsers. Each browser has a driver for starting and controlling a browser window. They possibly have to be updated if the browser version changes. The used drivers are located in your expecco installion directory below the installation folder in:
packages/exept/expecco/plugin/seleniumWebDriver/lib
In some cases, expecco may show a warning, that the driver version could be incompatible with the browser. This does not mean per se, that the combination does not work; instead, it means that the combination has not been tested by eXept, but may nevertheless work. If such a warning is shown, check the "Do not show this warning again" toggle, to have expecco remember that combination as "trusted" in your settings.
You find new driver versions at the following addresses:
Chrome/Chromium | ChromeDriver |
Edge | Microsoft WebDriver |
Firefox | GeckoDriver |
Internet Explorer | IEDriverServer |
For Internet Explorer it should be noted that Protected Mode settings must be set to the same value for all zones to be able to start a connection.
The plugin uses JavaScript. If you get an error like org.openqa.selenium.JavascriptException: Error executing JavaScript
ensure that the used browser allows the execution of JavaScript and that the versions of the browser and the associated driver are compatible.
Connecting[Bearbeiten]
Connection Edtitor[Bearbeiten]
The connection editor assists you to fastly define, change or start a connection. You get it by opening the GUI browser, clicking there on Connect and then selecting Selenium Testing (WebDriver).
- Load settings from file: Open a saved settings file (*.csf). Its settings will be added to the editor. Already entered inputs that are not conflicting will remain unchanged.
- Load settings from attachment: Open an attachment containing connection settings from an open project. This settings will be added to the editor. Already entered inputs that are not conflicting will remain unchanged.
- Save settings to file: Save all entered settings to a file (*.csf).
- Save settings as attachment: Save all entered settings as attachment in an open project.
- Advanced view: Toggle the view to enter advanced settings.
- Version info: Opens a window showing the used versions of the Selenium server, the selected browser and its driver.
- Online documentation: Open this online documentation.
- Connection name: Enter the name of the connection used to show it in the GUI browser. (Optional)
- URL: Enter the URL to open at startup. To open an empty browser window, leave this field empty. To open a local file use the scheme file://, e.g. file:///C:/Users/admin/Desktop/index.html.
- Browser type: Choose the type of browser to use. Ensure it is installed and the version of the used driver is compatible with the browser version.
- List of advanced settings: If you have set advanced settings, they will be displayed here.
Advanced Settings[Bearbeiten]
Besides the used browser and the start URL there are mor settings for a connection possible. To set them, change the view in the connection menu using the appropriate menu entry. Depending on the selected browser type you get different entry fields.
- Remote Server: If you wish to open the browser on another computer than where expecco is running, open a Selenium server there and set this field to its address. Of course you can also enter a local address if you do not want the Selenium server to start automatically. See the next section Remote Connections on how to start a Selenium server.
- Binary: Enter the path to the binary of the selected browser if it cannot be found automatically by Selenium or you have another version installed.
- Driver: For each browser a particular driver is needed for automation. New browser versions often need a new version of the associated driver. If you don't want to use the driver installed by expecco, set its path here.
- Firefox Profile: For Firefox it is possible to set a Firefox Profile, containing specific settings. If no profile is set, each connection will use an new empty one.
- Capabilities: Selenium connections can use several capabilities to define connection behaviors. If you want to use capabilities, you can set them in this field. Write <capability name>: <value> or <capability name> = <value>; one entry each line. You can also set properties for Firefox browser. Therefore use the same syntax as for the capabilities, but add a leading $ to the property name.
Remote Connections[Bearbeiten]
If you want to start a browser on a remote computer, you have to copy the Selenium server and the needed driver to that computer first. You find the files in your expecco installation at \exept\expecco\packages\exept\expecco\plugin\seleniumWebDriver\lib. Start the Selenium server using
java -jar selenium-server-standalone-3.6.0.jar
By default the server will be started on port 4444. If you want to use another port you can set it using the flag -port. To start a connection to that server, set the remote server of the connection to <Server-Adresse>:4444/wd/hub.
Possibly starting of the Selenium server must be allowed by your firewall.
Connection Blocks[Bearbeiten]
SeleniumWebDriverLibrary offers different block to start a Selenium connection within a testrun. The connection name has the function to identify the connection during the run if it switches between different connections and to disconnect. If you want to start a connection with setting you have saved as attachment, use the block Connect From File.
Plugin Settings[Bearbeiten]
If you want to use certain browser installations or driver for every connection, you can set them in the settings of the plugin. You find them in the menu selecting Extras > Settings and in the Plugins section Selenium WebDriver Extension. Everything you set there will be used for every connection except its connection settings say different.
Recorder[Bearbeiten]
If the GUI browser has a connection to a browser, the integrated recorder can be used to record a test case. You start the recorder by selecting the appropriate selection in the GUI browser and clicking the recor button. The recorder opens in an new window. Each click in the window ewcords an action. More actions are available in the menu. The recorded actions are added to the workspace of the GUI browser. This makes it possible to edit the recording immediately.
Components of the recorder windoow
- Pause recording: If the control lamp is red, the recorder is recording. Pause the recording by clicking on it. The control lamp will turn grey. In this state you can execute actions with the recorder, but they are not recorded. Click again to resume the recording.
- Update: Update the screenshot on the element tree. Necessary if the recorder view does not fit the browser content.
- Follow-Mouse: The element under the cursor is selected in the GUI browser.
- Element Highlighting: The element under the cursor gets a red frame.
- Element Tools: Select which tool to use for recording. The selected action is triggered by each click in the view. Following actions are available:
- Auto: Combination of all other tools. A Click is recorded for every left click and Drag And Drop for moving the mouse between press and release of the mouse button. All other actions are available by right clicking on an element.
- Click: Single click on the element
- Set Text: Set the text of an entry field
- Clear Text: Clear the text from an entry field
- Check Text: Check if the element contains a certain text
- Check Attribute: Check whether the value of a certain attribute matches the specified value
- Drag And Drop: Drag and drop an element to another supporting this function
- Switch to Frame: Switch to the context of the selected frame, making its content available.
- Select: Diefferent select actions e.g. to use in select menus
- Wait for: Different actions to wait for certain events refering to the selected element
- Browser Tools: Actions not refering to ocertain elements. Following actions are available:
- Get: Get a URL
- Scroll: Scroll the content of the browser window
- Check Title: Check if the title of the current page matches the specified value
- Switch To Parent: Return from a frame context to its parent context
- Switch To Window...: Switch between different windows or tabs of a connection
- Wait for: Different actions to wait for certain events not refering to an element
- Page navigation: Actions for page navigation: Back, Forward and Refresh Page
- Alert Handling: Click this button if the browser shows an alert, to be able to select the actions for alert handling.
- Online Documentation: Open this online documentation.
- Resize Window to Screen Size: Change the size of the window to show the whole screenshot.
- Set Screen Scale to Fit Window: Scale the screenshot to fully fit in the window
- Scale: Changes the scale of the screenshot. Can also be adjusted by the slider on the right.
- Control Lamp: Shows the state of the recorder
- green: The recorder is ready
- red: The recorder is blocked, the view and the element list are updated
- grey: The recoreder cannot be used anymore, the connection is corrupted or closed
Transferring Old Selenium Tests[Bearbeiten]
This Plugin replaces the previous Selenium Web Test Plugin, which is based on Selenium RC, which will be no longer supported. Its successor is Selenium WebDriver, also referred to as Selenium 2. Recording tests using Selenim IDE is outdated as well, as the plugin is not supported by newer browsers. The Selenium WebDriver Plugin uses its own Recorder instead.
Tests that were created with the old Selenium WebTest Plugin using SeleniumLibrary can be executed with Selenium WebDriver. For this purpose go to the plugin settings of Webtest Legacy (Selenium) and check Use WebDriver for execution. Then verify if your tests are still running with this change. For most of the blocks there should be no problems.