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: docs/plugins/code-export.md
+38-3Lines changed: 38 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,39 @@ title: Code Export Plugin Support
4
4
sidebar_label: Exporting Code
5
5
---
6
6
7
-
The plugins API enables any Selenium IDE plugin to be export code in response to certain events (or "hooks").
7
+
The plugins API enables any Selenium IDE plugin to export code for either:
8
+
9
+
1. an existing language
10
+
2. a new language
8
11
9
12
### Export config
10
13
11
-
In your plugin manifest you'll need to specify that it exports languages, and for which ones.
14
+
In your plugin manifest you'll need to specify that it exports languages.
15
+
16
+
<u>Add to an existing language</u>
17
+
18
+
To augment an existing language, use the `languages` key and specify which ones in an array.
12
19
13
20
```javascript
14
21
"exports": {
15
22
"languages": ["java-junit"]
16
23
}
17
24
```
18
25
26
+
The currently available language ids `"java-junit"`, `"javascript-mocha"`, and `"python-pytest"`.
27
+
28
+
<u>Add a new language</u>
29
+
30
+
To add a new language to code export, use the `vendor` key and specify your langauge in an object array.
31
+
32
+
```javascript
33
+
"exports": {
34
+
"vendor": [{"your-language":"Your language"}]
35
+
}
36
+
```
37
+
38
+
The key is the ID which will be used in the export event. The value is the display name that will be used in the code export menu in the UI.
39
+
19
40
### Export event
20
41
21
42
Selenium IDE sends the following event for each entity type, which your plugin can respond to for code export.
@@ -30,7 +51,7 @@ Selenium IDE sends the following event for each entity type, which your plugin c
30
51
```
31
52
32
53
-`action` - `export`, indicating an action that requires code export
33
-
-`entity`, the entity to export, can be `command` or any of [the hooks mentioned in the next section](code-export.md#hooks)
54
+
-`entity`, the entity to export, can be `command`, any of [the hooks mentioned in the next section](code-export.md#hooks), or `vendor` if exporting a new language
34
55
-`options` - metadata to help your plugin make more informed decisions about what to export (e.g., project, test name, suite name, etc.)
35
56
36
57
## Hooks
@@ -49,6 +70,8 @@ Code export is built around the notion of hooks, which offers entry points into
49
70
50
71
## Response
51
72
73
+
### Add to an existing language
74
+
52
75
To respond to an export event, call `sendResponse` along with the string you'd like to export. If there are multiple lines to your string, separate them with newline characters (e.g., `\n`).
53
76
54
77
Or you can look into using the command object structure mentioned in the [code export getting started](introduction/code-export.md#2-update-the-locators-and-commands).
@@ -57,4 +80,16 @@ Or you can look into using the command object structure mentioned in the [code e
In response to a `vendor` export event for your new language(s), your plugin needs to respond with the an object containing the keys `filename` and `body`.
86
+
87
+
```javascript
88
+
constpayload= {
89
+
filename:'test.js',
90
+
body:'// your final exported code\n// goes here\n// etc.'
0 commit comments