<tfoot id='14Zhp'></tfoot>

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

    <small id='14Zhp'></small><noframes id='14Zhp'>

        <bdo id='14Zhp'></bdo><ul id='14Zhp'></ul>

      <legend id='14Zhp'><style id='14Zhp'><dir id='14Zhp'><q id='14Zhp'></q></dir></style></legend>

        在由 Selenium 驱动的 PhantomJS C# 中设置屏幕大小

        Setting screen size in PhantomJS C# being driven by Selenium(在由 Selenium 驱动的 PhantomJS C# 中设置屏幕大小)
          <bdo id='LFJHm'></bdo><ul id='LFJHm'></ul>
            <tbody id='LFJHm'></tbody>
          <tfoot id='LFJHm'></tfoot>

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

                • <legend id='LFJHm'><style id='LFJHm'><dir id='LFJHm'><q id='LFJHm'></q></dir></style></legend>
                  <i id='LFJHm'><tr id='LFJHm'><dt id='LFJHm'><q id='LFJHm'><span id='LFJHm'><b id='LFJHm'><form id='LFJHm'><ins id='LFJHm'></ins><ul id='LFJHm'></ul><sub id='LFJHm'></sub></form><legend id='LFJHm'></legend><bdo id='LFJHm'><pre id='LFJHm'><center id='LFJHm'></center></pre></bdo></b><th id='LFJHm'></th></span></q></dt></tr></i><div id='LFJHm'><tfoot id='LFJHm'></tfoot><dl id='LFJHm'><fieldset id='LFJHm'></fieldset></dl></div>
                  本文介绍了在由 Selenium 驱动的 PhantomJS C# 中设置屏幕大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何设置浏览器的屏幕尺寸?当我如下设置 PhantomJS 后截屏时,它只显示 400px 宽的图像.

                  How do I set the browser screen size? When I take a screen shot after setting up PhantomJS as below its only showing a 400px wide image.

                  var driverService = PhantomJSDriverService.CreateDefaultService();
                  driverService.HideCommandPromptWindow = true;
                  driverService.LoadImages = false;
                  driverService.ProxyType = "none";      
                  
                  using (var driver = new PhantomJSDriver(driverService))
                  {
                      etc....
                  }
                  

                  推荐答案

                  应该和其他浏览器设置窗口大小一样,可以看一下这个例子:如何获取使用 Selenium WebDriver 调整窗口大小、调整窗口大小或最大化窗口.

                  It should be the same as setting window size in any other browsers, feel free to have a look at this example: How to get window size, resize or maximize window using Selenium WebDriver.

                  这里是为我工作的测试代码:

                  Here is the code tested working for me:

                  var driverService = PhantomJSDriverService.CreateDefaultService();
                  driverService.HideCommandPromptWindow = true;
                  driverService.LoadImages = false;
                  driverService.ProxyType = "none";
                  
                  using (var driver = new PhantomJSDriver(driverService)) {
                      driver.Manage().Window.Size = new Size(1920, 1080); // Size is a type in assembly "System.Drawing"
                      driver.Url = "http://www.stackoverflow.com";
                      driver.TakeScreenshot().SaveAsFile(@"c:phantomjs_screenshot.png", ImageFormat.Png);
                  }
                  

                  这篇关于在由 Selenium 驱动的 PhantomJS C# 中设置屏幕大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的代码使该程序集对我的解决方案的其余部分不可用)

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

                    <bdo id='y8xZk'></bdo><ul id='y8xZk'></ul>
                  • <legend id='y8xZk'><style id='y8xZk'><dir id='y8xZk'><q id='y8xZk'></q></dir></style></legend>

                    • <tfoot id='y8xZk'></tfoot>
                        1. <small id='y8xZk'></small><noframes id='y8xZk'>