以下是似乎无法执行的测试用例代码。有没有Firefox的配置问题?无法访问浏览器:会话未创建异常
package testOperations;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class FunctionalTest {
//Code for launching the required link into browser
WebDriver driver;
@BeforeTest
public void launchUrl() {
System.setProperty("webdriver.gecko.driver", "C://MavenTest//driver/geckodriver.exe");
driver = new FirefoxDriver();
driver.get("https://letskodeit.teachable.com/p/practice");
}
在运行代码时,只有空白浏览器窗口正在打开,并且测试用例失败。
@Test
public void radioButtoncheck() {
boolean list = driver.findElements(By.tagName("radio")).get(2).isSelected();
if (list!=true) {
driver.findElement(By.id("hondaradio")).click();
}
else {
driver.findElement(By.id("benzradio")).click();
}
}
}
能否请附上错误输出运行测试,当你? – Thibstars
测试用例失败输出屏幕截图 – User6
我正在使用硒独立3.0.1和geckodriver以及它的显示空白morzilla浏览器选项卡打开。 – User6