You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Preview.md
+28-4
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,38 @@ layout: default
6
6
{:toc}
7
7
8
8
# Overview
9
-
Preview presents custom HTML reports or forms. It allows Selenese scripts to interact with the user. It can collect confirmation, selection or data entry. When the user operates Preview, it can trigger Selenese commands. That subsequent processing executes like classic Selenese run. The user can pause, stop or debug it.
9
+
Preview generates custom HTML and XML reports. It can present HTML forms. Those allow Selenese scripts to interact with the user. It can collect confirmation, selection or data entry. When the user operates Preview, it triggers further Selenese actions. That subsequent processing executes like classic Selenese run. The user can pause, stop or debug it.
10
10
11
-
The presentation in HTML or XML is customizable through client-side templates, such as [PURE](https://github.com/pure/pure). Together with [SelBlocks Global] > [Out-of-flow Selenese callbacks](SelBlocksGlobal#out-of-flow-selenese-callbacks) Preview enables a bidirectional channel between [Selenium IDE](SeleniumIDEtips) and the presentation window. The report or form can subsequently call custom Selenese functions (i.e. blocks of Selenese commands). That allows user scripts to run interactively.
11
+
The presentation in HTML or XML is customizable through client-side templates, such as [PURE](https://github.com/pure/pure). (As of March 2016, PURE is the easiest engine listed on https://developer.mozilla.org/en-US/docs/JavaScript_templates.)
12
+
13
+
Together with [SelBlocks Global] > [Out-of-flow Selenese callbacks](SelBlocksGlobal#out-of-flow-selenese-callbacks) Preview enables a bidirectional channel between [Selenium IDE](SeleniumIDEtips) and the presentation window. The report or form can subsequently call custom Selenese functions (i.e. blocks of Selenese commands). That allows user scripts to run interactively.
12
14
13
15
# Bookmarking and exporting
14
16
The content renders in a standard Firefox window. The user can bookmark it, or pass the URL to it. It uses [data: URIs](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs), hence it works without a need to pass any files. (`data:` URI can also contain images, stylesheets and Javascripts). This works for XML, too.
15
17
18
+
# Configuration
19
+
There are two primary ways to pass the data:
20
+
21
+
* injecting into in-HTML Javascript. The default method. Its benefits are
22
+
* extra 'validation' of the encoded data. (Since it's within the location part of `data:` URL, it is either well formed or not. If well formed, then both the content and the data is guaranteed to be present.)
23
+
* easier debugging (simpler code)
24
+
* it allows anchor (fragment) references (URLs) within the content
25
+
* via URL hash (anchor fragment). Activated by configuration field `dataInHash`
26
+
* benefit: you can re-use of the same content with various data by replacing the # hash (anchor fragment) part of `data:` URL
27
+
* downsides
28
+
* more fragile and longer `data:` URL
29
+
* it doesn't allow anchor (fragment) references (URLs) within the content
30
+
31
+
# Debugging/readability options
32
+
By default Preview generates `data:` URL with base64 encoding. Following options make `data:` URLs more readable:
33
+
34
+
*`urlEncodeData` - only applicable with `dataInHash`. It makes the encoded data a bit more readable (as compared to default base64 encoding).
35
+
*`urlEncodeContent` - regardless of the source code and of how you pass the data
36
+
Those options are disabled by default, since they generate longer `data:` URLs.
37
+
16
38
# Connection back to Selenium IDE
17
-
Preview is "live" and connected to Selenium IDE, but only in the window that was opened from Selenium IDE by `getEval | editor.openPreview( templateURL, data, config )`. From the content in Preview invoke Selenese functions via [SelBlocks Global]>[Out-of-flow Selenese callbacks](SelBlocksGlobal#out-of-flow-selenese-callbacks).
39
+
HTML Preview is "live" and connected to Selenium IDE, but only in the window that was opened from Selenium IDE by `getEval | editor.openPreview( templateURL, data, config )`. From the content in Preview invoke Selenese functions via [SelBlocks Global]>[Out-of-flow Selenese callbacks](SelBlocksGlobal#out-of-flow-selenese-callbacks).
40
+
41
+
The user may not be able to navigate backwards & forwards in Preview. Otherwise links in Preview could be in conflict with Selenese state (call stack, stored variables) once the user executes any further Selenese commands.
18
42
19
-
The user may not be able to navigate backwards & forwards in Preview. Otherwise links in Preview could be in conflict with Selenese state (call stack, stored variables) once the user executes any further Selenese commands.
43
+
We can't pass the data via query string (?param1=value2¶m2=value2...) due to [data: URI limitations](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs#Common_problems).
0 commit comments