1. <i id='j1UFB'><tr id='j1UFB'><dt id='j1UFB'><q id='j1UFB'><span id='j1UFB'><b id='j1UFB'><form id='j1UFB'><ins id='j1UFB'></ins><ul id='j1UFB'></ul><sub id='j1UFB'></sub></form><legend id='j1UFB'></legend><bdo id='j1UFB'><pre id='j1UFB'><center id='j1UFB'></center></pre></bdo></b><th id='j1UFB'></th></span></q></dt></tr></i><div id='j1UFB'><tfoot id='j1UFB'></tfoot><dl id='j1UFB'><fieldset id='j1UFB'></fieldset></dl></div>
    2. <small id='j1UFB'></small><noframes id='j1UFB'>

        <tfoot id='j1UFB'></tfoot>

      1. <legend id='j1UFB'><style id='j1UFB'><dir id='j1UFB'><q id='j1UFB'></q></dir></style></legend>
          <bdo id='j1UFB'></bdo><ul id='j1UFB'></ul>

      2. 为 Selenium PhantomJSDriver 指定 PhantomJS 命令行选项

        Specify PhantomJS command line optionsto Selenium PhantomJSDriver(为 Selenium PhantomJSDriver 指定 PhantomJS 命令行选项)

          <small id='8yTyI'></small><noframes id='8yTyI'>

            <tbody id='8yTyI'></tbody>
          <tfoot id='8yTyI'></tfoot>
          <i id='8yTyI'><tr id='8yTyI'><dt id='8yTyI'><q id='8yTyI'><span id='8yTyI'><b id='8yTyI'><form id='8yTyI'><ins id='8yTyI'></ins><ul id='8yTyI'></ul><sub id='8yTyI'></sub></form><legend id='8yTyI'></legend><bdo id='8yTyI'><pre id='8yTyI'><center id='8yTyI'></center></pre></bdo></b><th id='8yTyI'></th></span></q></dt></tr></i><div id='8yTyI'><tfoot id='8yTyI'></tfoot><dl id='8yTyI'><fieldset id='8yTyI'></fieldset></dl></div>
              <bdo id='8yTyI'></bdo><ul id='8yTyI'></ul>
              1. <legend id='8yTyI'><style id='8yTyI'><dir id='8yTyI'><q id='8yTyI'></q></dir></style></legend>

                1. 本文介绍了为 Selenium PhantomJSDriver 指定 PhantomJS 命令行选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  PhantomJS 驱动程序是否支持命令行参数?我需要使用 PhantomJS 驱动程序运行 Selenium 测试并禁用网络安全.我试过了:

                  Does the PhantomJS driver support command line arguments? I need to run Selenium tests with the PhantomJS driver and disable web security. I have tried:

                  PhantomJSOptions options = new PhantomJSOptions();           
                  options.AddAdditionalCapability("web-security",false);             
                  driver = new PhantomJSDriver(Environment.CurrentDirectory + @"drivers", options);
                  

                  但这似乎不起作用.PhantomJSDriver 是否允许传递命令行参数?

                  but this does not seem to work. Does the PhantomJSDriver allow for passing command line arguments?

                  推荐答案

                  您可以使用 --web-security 命令行选项.com/p/selenium/source/browse/dotnet/src/WebDriver/PhantomJS/PhantomJSDriverService.cs#178" rel="nofollow">PhantomJSDriverService.WebSecurity 属性,而不是将其作为 PhantomJSOptions.

                  You can specify PhantomJS' --web-security command line options using PhantomJSDriverService.WebSecurity Property, rather than pass it as PhantomJSOptions.

                  这是在 Selenium 2.32.0 中添加的,引用自 CHANGELOG:

                  This is added in Selenium 2.32.0, a quote from CHANGELOG:

                  (代表 GeoffMcElhanon)添加了对传递参数的支持幻影JS.PhantomJSDriverService 现在具有类型安全的属性对于 PhantomJS 支持的所有命令行开关.这些可以直接在命令行传递,也可以序列化到一个 JSON 文件中,用于通过 --config 命令行开关传递到 PhantomJS.

                  (on behalf of GeoffMcElhanon) Added support to pass arguments to PhantomJS. The PhantomJSDriverService now has type-safe properties for all of the command-line switches supported by PhantomJS. These can be passed directly on the command line, or can be serialized into a JSON file for passing with the --config command line switch to PhantomJS.

                  以下是未经测试的代码,必要时请参考文档(Selenium zip 文件中的 WebDriver.chm).

                  Below is the untested code, please refer to the documentation (the WebDriver.chm in your Selenium zip file) when necessary.

                  var service = PhantomJSDriverService.CreateDefaultService(Environment.CurrentDirectory + @"drivers");
                  service.WebSecurity = false;
                  var driver = new PhantomJSDriver(service);
                  

                  PhantomJSDriverService 有其他可以指定的预定义命令行参数,请查看文档.还有一些方法可以添加您自己的参数.

                  PhantomJSDriverService has other pre-defined command line arguments one can specify, please check documentation. Also there are methods to add your own arguments.

                  AddArgument(): 将单个参数添加到要附加到 PhantomJS.exe 命令行的参数列表中.
                  AddArguments(IEnumerable): 添加要附加到 PhantomJS.exe 命令行的参数.
                  AddArguments(String[]): 添加要附加到 PhantomJS.exe 命令行的参数.

                  AddArgument(): Adds a single argument to the list of arguments to be appended to the PhantomJS.exe command line.
                  AddArguments(IEnumerable): Adds arguments to be appended to the PhantomJS.exe command line.
                  AddArguments(String[]): Adds arguments to be appended to the PhantomJS.exe command line.

                  这篇关于为 Selenium PhantomJSDriver 指定 PhantomJS 命令行选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)
                      <tfoot id='ZL11R'></tfoot>

                      <i id='ZL11R'><tr id='ZL11R'><dt id='ZL11R'><q id='ZL11R'><span id='ZL11R'><b id='ZL11R'><form id='ZL11R'><ins id='ZL11R'></ins><ul id='ZL11R'></ul><sub id='ZL11R'></sub></form><legend id='ZL11R'></legend><bdo id='ZL11R'><pre id='ZL11R'><center id='ZL11R'></center></pre></bdo></b><th id='ZL11R'></th></span></q></dt></tr></i><div id='ZL11R'><tfoot id='ZL11R'></tfoot><dl id='ZL11R'><fieldset id='ZL11R'></fieldset></dl></div>

                        <bdo id='ZL11R'></bdo><ul id='ZL11R'></ul>
                            <tbody id='ZL11R'></tbody>
                          <legend id='ZL11R'><style id='ZL11R'><dir id='ZL11R'><q id='ZL11R'></q></dir></style></legend>

                            <small id='ZL11R'></small><noframes id='ZL11R'>