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
6161 ... 0987
6262 Alert Should Be Present 123 timeout=10 s
6363
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+
6476Execute Javascript from File
6577 [Documentation]
6678 ... LOG 2:1 REGEXP: Reading JavaScript from file .*executed_by_execute_javascript.*
Original file line number Diff line number Diff line change 1616
1717import os
1818from collections import namedtuple
19- from typing import Any
19+ from typing import Any , Union
2020
2121from robot .utils import plural_or_not , seq2str
2222
23+ from selenium .webdriver .remote .webelement import WebElement
2324from SeleniumLibrary .base import LibraryComponent , keyword
2425
2526
@@ -29,7 +30,7 @@ class JavaScriptKeywords(LibraryComponent):
2930 arg_marker = "ARGUMENTS"
3031
3132 @keyword
32- def execute_javascript (self , * code : str ) -> Any :
33+ def execute_javascript (self , * code : Union [ WebElement , str ] ) -> Any :
3334 """Executes the given JavaScript code with possible arguments.
3435
3536 ``code`` may be divided into multiple cells in the test data and
You can’t perform that action at this time.
0 commit comments