Hi,
I have a selenium script written in Eclipse. When I run it in Eclipse, it launches a new browser. Now, I want it to run in DevTest so I added a new step called 'Execute script (JSR-223)', choose Groovy and pasted the code below. I need to use IE instead of the default Firefox driver that comes with DevTest.
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.security.Credentials;
import org.openqa.selenium.security.UserAndPassword;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.*;
import java.util.concurrent.TimeUnit;
InternetExplorerDriver wd;
File file = new File("C:/driver/IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
wd = new InternetExplorerDriver();
wd.navigate().to("http://google.com");
Now, when I try to run the script, it throws the following exception. I tried to search the discussion board and found a similar situation, Unable to execute Selenium Script with Chrome/IE Driver but it doesn't mention any solution. How do we call executables / other processes via this scripting step?
Error in Script
============================================================================
| Step: Execute script (JSR-223)
----------------------------------------------------------------------------
| Message: java.lang.SecurityException: Scripts cannot call Runtime.exec()
----------------------------------------------------------------------------
| Trapped Exception: java.lang.SecurityException: Scripts cannot call Runtime.exec()
| Trapped Message: javax.script.ScriptException: java.lang.SecurityException: Scripts cannot call Runtime.exec()