File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
atest/acceptance/keywords
src/SeleniumLibrary/keywords Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ Execute Javascript With ARGUMENTS Marker Only
61
61
... 0987
62
62
Alert Should Be Present 123 timeout=10 s
63
63
64
+ Execute Javascript With ARGUMENTS Marker And WebElement
65
+ [Documentation]
66
+ ... Checks if the body (WebElement)
67
+ ... is parsed correctly as script argument
68
+ ... then compare its tagName to 'body'
69
+ ${body_webelement } Get WebElement css:body
70
+ ${tag_name } Execute Javascript
71
+ ... return arguments[0].tagName;
72
+ ... ARGUMENTS
73
+ ... ${body_webelement }
74
+ Should Be Equal As Strings ${tag_name } body ignore_case=True
75
+
64
76
Execute Javascript from File
65
77
[Documentation]
66
78
... LOG 2:1 REGEXP: Reading JavaScript from file .*executed_by_execute_javascript.*
Original file line number Diff line number Diff line change 16
16
17
17
import os
18
18
from collections import namedtuple
19
- from typing import Any
19
+ from typing import Any , Union
20
20
21
21
from robot .utils import plural_or_not , seq2str
22
22
23
+ from selenium .webdriver .remote .webelement import WebElement
23
24
from SeleniumLibrary .base import LibraryComponent , keyword
24
25
25
26
@@ -29,7 +30,7 @@ class JavaScriptKeywords(LibraryComponent):
29
30
arg_marker = "ARGUMENTS"
30
31
31
32
@keyword
32
- def execute_javascript (self , * code : str ) -> Any :
33
+ def execute_javascript (self , * code : Union [ WebElement , str ] ) -> Any :
33
34
"""Executes the given JavaScript code with possible arguments.
34
35
35
36
``code`` may be divided into multiple cells in the test data and
You can’t perform that action at this time.
0 commit comments