I am trying to run an existing Selenium Script within Tosca. But there seems to be an issue and none of the existing articles really help me.
I used the standard tbox modules "Start Selenium Server" and "Run Selenium Scripts". In those modules I changed the path to the .jar file which I created with maven. I have written the testcases with junit 4 and used chrome webdriver to execute them. When I execute them in IntelliJ they work perfectly fine but as soon as I try to import them Tosca fails to execute. The code looks like this:
public class F {
private WebDriver driver;
private JavascriptExecutor js;
private WebDriverWait wait;
@Before
public void init(){
System.setProperty("webdriver.chrome.driver", "P:/Documents/seflx/chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
js = (JavascriptExecutor) driver;
wait = new WebDriverWait(driver, 30);
driver.manage().window().maximize();
driver.get("url");
}
@Test
public void searchSubmission() {
driver.switchTo().defaultContent();
driver.switchTo().frame("workflow_frame_1");
WebElement initScreen = driver.findElement(By.className("loading-screen"));
WebElement loadingScreen = driver.findElement(By.xpath("/html"));
}
As you can see in the code, I have no main class, is this the problem? Because I read in the Tosca documentary that junit is supported.
What I expect is that within tosca the selenium jar file is executed. The current outcome I get is this:
Selenium Server started successfully
Run Selenium Scripts: startIndex cannot be larger than length of string.
Parameter name: startIndex
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
at System.String.Substring(Int32 startIndex, Int32 length)
at Tricentis.Automation.SpecialExecutionTasks.SeleniumExecution.ExecuteSeleniumTestsSpecialExecutionTask.AnalyzeJunitTestResult(String resultMessage, String outputHtml, String projectPathToLog)
at Tricentis.Automation.SpecialExecutionTasks.SeleniumExecution.ExecuteSeleniumTestsSpecialExecutionTask.Execute(ISpecialExecutionTaskTestAction testAction)
at Tricentis.Automation.SpecialExecutionTasks.SeleniumExecution.ExecuteSeleniumTestsSpecialExecutionTask.ExecuteTask(ISpecialExecutionTaskTestAction testAction)
at ᜈ.ᜀ()
at ᜈ.ᜁ()
at Tricentis.Automation.Execution.ItemExecutor`1.Execute()