java - 带有 Jenkins 的 Selenium WebDriver

标签 java selenium jenkins selenium-webdriver jenkins-plugins

我正在考虑将 Selenium WebDriver 与 Jenkins 结合使用。我们有一个在 Windows Server 2008 下运行的 Jenkins 服务器,我想运行我所有的测试用例,我正在使用 mstest 并且我还在 Windows 服务器上安装了 VS...这是我在我的服务器上安装的插件列表:

Selenium Auto Exec Server(AES) plugin
This plugin is for continuous regression test by Selenium Auto Exec Server (AES).      0.5          

Jenkins Selenium Builder plugin
1.1         

Hudson Seleniumhq plugin
This plugin integrates Seleniumhq to Hudson.
0.4         

Selenium HTML report
0.94            

SeleniumRC plugin
This plugin allows you to create Selenium server instance for each project build.
1.0 

Jenkins 上是否安装了任何插件?

编辑

这就是我用来实例化我的驱动程序的东西,我必须使用 RemoteDriver 吗?

public static IWebDriver GetDriver()
{
    string _url = new Uri(Common.Url).DnsSafeHost.ToString(); 

     switch (Common.BrowserSelected)
     {
         case "ff":
         FirefoxProfile profile = new FirefoxProfile();
         profile.SetPreference("network.http.phishy-userpass-length", 255);
         profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", _url);
         drv = new FirefoxDriver(profile);
                    break;
          case "ie":
          var options = new InternetExplorerOptions();
           options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
           DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(CapabilityType.AcceptSslCertificates, true);
                    drv = new InternetExplorerDriver(options);
                    break;
                case "chrome":
                    //_driver = new ChromeDriver();
                    break;
            }
            return drv;
        }

最佳答案

Jenkins 上是否安装了任何插件?

-不,您不需要这些插件。

这就是我用来实例化我的驱动程序的东西,我必须使用 RemoteDriver 吗?

我认为您需要 RemoteDriver 来执行您的测试,并且您需要在 GetDriver() 函数中为此 RemoteDriver 添加初始化。

也许你能帮上忙 linkthis

我的配置:

firefox {
    capability = DesiredCapabilities.firefox()
    capability.setPlatform(Platform.LINUX)
    driver = {new RemoteWebDriver(new URL("http://some.domain:4444/wd/hub"), capability)}
}

所以我使用Geb用于测试,但我认为没有区别。

关于java - 带有 Jenkins 的 Selenium WebDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15509666/

相关文章:

java - 使用 intellij IDEA 从 Selenium + JUnit 生成 ANT 结果报告

java - 使用池连接时它不起作用。(Hibernate 和 c3p0)

java - 在 Android 应用程序上发出 POST 请求

尝试添加一行来创建 Map 时出现 Javassist CannotCompileException

java - 强制 "respond_do"格式

maven - 如何在 Jenkins Maven 作业中发布 Scalastyle 结果?

java - 在网页中找不到定位器(Xpath,Css)

python - PhantomJS - 连接到 GhostDriver 错误

windows - Jenkins windows bool 参数中的 IF 语句

通过 gradle 4.5 将 600MB 文件上传到 Nexus 时出现 Java 堆空间错误