以下是似乎無法執行的測試用例代碼。有沒有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