我是 Selenium 网格的新手。我的集线器和节点正在运行。我尝试了一个测试以在节点中自动化。但我收到错误“无法初始化类 org.openqa.selenium.os.Kernel32”。我在任何地方都找不到解决方案。请帮忙
我的代码是:
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import java.net.MalformedURLException;
public class TestGrid {
WebDriver driver;
String baseURL, nodeURL;
@BeforeTest
public void setup() throws MalformedURLException{
baseURL = "http://newtours.demoaut.com/";
nodeURL = "http://192.168.0.6:5566/wd/hub";
DesiredCapabilities capability = DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.WIN8);
driver = new RemoteWebDriver(new URL(nodeURL), capability);
}
@Test
public void verifyTitle() {
String actualTitle = driver.getTitle();
String expectedTitle = "Welcome: Mercury Tours";
Assert.assertEquals(actualTitle, expectedTitle);
}
@AfterTest
public void closeSetup(){
driver.quit();
}
}