Robot Framework SeleniumLibrary
scope_event.py
Go to the documentation of this file.
1 # Copyright 2008-2011 Nokia Networks
2 # Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors
3 # Copyright 2016- Robot Framework Foundation
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 from robot.libraries.BuiltIn import BuiltIn
18 
19 from .event import Event
20 
21 
23 
24  def __init__(self, scope, action, *args, **kwargs):
25  self.scopescope = scope
26  self.actionaction = action
27  self.action_argsaction_args = args
28  self.action_kwargsaction_kwargs = kwargs
29 
30  if scope == 'current':
31  suite = BuiltIn().get_variable_value('${SUITE NAME}')
32  test = BuiltIn().get_variable_value('${TEST NAME}', '')
33  self.scopescope = suite + '.' + test if test != '' else suite
34 
35  def trigger(self, *args, **kwargs):
36  if args[0] == self.scopescope:
37  self.actionaction(*self.action_argsaction_args, **self.action_kwargsaction_kwargs)
38 
39 
41  name = 'scope_start'
42 
43 
45  name = 'scope_end'
def __init__(self, scope, action, *args, **kwargs)
Definition: scope_event.py:24