我正在尝试在Tosca中运行现有的Selenium脚本。但是似乎有一个问题,现有文章都没有对我有任何帮助。
我使用了标准的tbox模块“启动Selenium服务器”和“运行Selenium脚本”。在这些模块中,我将路径更改为使用maven创建的.jar文件。我已经用junit 4编写了测试用例,并使用chrome webdriver来执行它们。当我在IntelliJ中执行它们时,它们可以正常工作,但是一旦我尝试导入它们,Tosca便无法执行。 代码如下:
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"));
}
您可以在代码中看到,我没有主类,这是问题吗?因为我在Tosca纪录片中读到了junit的支持。
我希望在tosca中执行硒罐文件。我得到的当前结果是:
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()