【问题标题】:The Constructor RemoteWebDriver(URL, DesiredCapabilities) is undeifned构造函数 RemoteWebDriver(URL, DesiredCapabilities) 未定义
【发布时间】:2020-04-11 16:40:17
【问题描述】:

此行有多个标记 - 构造函数 RemoteWebDriver(URL, DesiredCapabilities) 未定义 - 构造函数 URL(String) 未定义

' 打包 GridLearnings;

import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.Test;

import com.gargoylesoftware.htmlunit.javascript.host.URL;

public class GridSample  {

    @Test
    public void TestLogin()
    {
        DesiredCapabilities cap= DesiredCapabilities.chrome();
        cap.setBrowserName("Chrome");
        cap.setPlatform(Platform.ANY);

        RemoteWebDriver d =new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);



    }

}

'

【问题讨论】:

  • 您认为我们正在了解您想要做什么的完整背景吗?期望什么?怎么了?请阅读minimal reproducible example 并相应地编辑您的问题,然后在下一篇文章中遵循相同的内容

标签: java selenium selenium-chromedriver selenium-grid


【解决方案1】:

RemoteWebDriver 接受 URL 作为参数,但 URL 来自 java.net 包。

改变 import com.gargoylesoftware.htmlunit.javascript.host.URL;

收件人:import java.net.URL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-15
    • 2016-05-20
    • 2012-03-24
    • 1970-01-01
    • 1970-01-01
    • 2011-04-11
    • 2020-09-30
    • 1970-01-01
    相关资源
    最近更新 更多