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: CustomisingSelenese.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ layout: default
8
8
# Identifying Javascript implementation of Selenese commands
9
9
Do not search for implementation functions of Selenese action [commands][command] case-sensitively. Actions (i.e. ones with primary forms that don't start with **`get`** neither with **`is`** and that are not like <code><strong>is</strong>Xyz<strong>Present</strong></code> - as per table at {{navAutoGeneratedSeleneseCommands}}) are defined in Javascript functions whose names start with **`do`**. E.g. command `xyz` is implemented in function <code><strong>do</strong>Xyz</code>.
10
10
11
-
For locating the source code of those Javascript functions see [JavascriptSpecial](JavascriptSpecial) > [Locating a Javascript function in sources](JavascriptSpecial#locating-a-javascript-function-in-sources).
11
+
For locating the source code of those Javascript functions see [JavascriptSpecial](JavascriptSpecial) > [Locating a Javascript function in sources](JavascriptSpecial#locating-a-javascript-function).
12
12
13
13
# Defining functions in Selenium Core #
14
14
This is for files normally loaded into [Core scope] (via [Bootstrap](Bootstrap) or [Extension Sequencer], which use [JavascriptComplex](JavascriptComplex) > [mozIJSSubScriptLoader](JavascriptComplex#mozIJSSubScriptLoader)). (That's not for {{navJavascriptCodeModules}}.)
Copy file name to clipboardExpand all lines: JavascriptSpecial.md
+17-2
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,10 @@ layout: default
4
4
* TOC
5
5
{:toc}
6
6
7
-
# Locating a Javascript function in sources #
8
-
There are various ways of how to define/set/override a function in Javascript (usually through setting it as if it were a field on the class prototype object). So if you need to debug/modify/extend a function, it may not be easy to locate. You can use the following regular expressions to find definition(s) of a function (if implemented in one of the common ways). Replace `FUNCTION` with the name of the function.
7
+
# Locating Javascript symbols in source
8
+
9
+
## Locating a Javascript function
10
+
There are various ways of how to define/set/override a function in Javascript (usually through setting it as if it were a field on the class prototype object). Hence if you need to debug/modify/extend a function, it may not be easy to locate. You can use the following regular expressions to find definition of a function (if implemented in one of the common ways). Replace `FUNCTIONNAME` with the name of the function.
This is especially useful with Selenium which uses same name functions in various classes/components. There may be various versions of the same class/component, depending on how the code is executed - via Selenium IDE or via webdriver (but only Selenium Core and IDE is relevant to SeLite).
23
25
26
+
## Locating classes in Selenium IDE
24
27
In Selenium IDE sources search for class definitions with regex:
25
28
26
29
```
27
30
className *= *classCreate *\(
28
31
```
29
32
33
+
## Locating variables and object fields
34
+
Replace `VARIABLENAME` with the name of the variable. The regex itself, e.g. for use in NetBeans:
When searching for an object field (rather than a variable), if the above doesn't find it as a field but only as a top-level variable, that may be when the Javascript file that defines the variable is loaded within a scope that is stored in the target object.
40
+
41
+
For example, _chrome/content/selenium-runner.js_ defines a top-level variable `var LOG`. That file is loaded within scope of `runner` object from file _content/debugger.js_. That defines field `LOG` in `runner` object.
42
+
43
+
Search for (literal) `.loadSubScript` and find one that is `.loadSubScript`( _locationOfJavascriptFileThatDefinesTheVariable_, _objectWhereThatVariableBecomesAField_ ).
44
+
30
45
# Function intercepts
31
46
This is for extending or completely replacing behaviour of existing functions that come from Selenium or third party. It can be done for ordinary (non-member) functions (including class constructors) and also for methods (member functions of objects). Methods can be intercepted on either
0 commit comments