PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/java/client/src/org/openqa/selenium/internal/selenesedriver/ExecuteScript.java

https://bitbucket.org/abahdanovich/selenium
Java | 36 lines | 14 code | 7 blank | 15 comment | 0 complexity | 181cdbf76a75000bac3dbc7e60e99b66 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, AGPL-1.0, MIT, Apache-2.0, BSD-3-Clause, GPL-2.0
  1. /*
  2. Copyright 2007-2009 Selenium committers
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package org.openqa.selenium.internal.selenesedriver;
  14. import com.thoughtworks.selenium.Selenium;
  15. import java.util.List;
  16. import java.util.Map;
  17. public class ExecuteScript implements SeleneseFunction<Object> {
  18. public Object apply(Selenium selenium, Map<String, ?> parameters) {
  19. String script = (String) parameters.get("script");
  20. @SuppressWarnings({"unchecked"})
  21. List<Object> args = (List<Object>) parameters.get("args");
  22. return new ScriptExecutor(selenium)
  23. .inContextOfApplicationUnderTest()
  24. .executeScript(script, args);
  25. }
  26. }