C#硒Mobile仿真景观 [英] C# Selenium Mobile Emulation in landscape

查看:930
本文介绍了C#硒Mobile仿真景观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做使用C#在.NET环境中使用Selenium一些移动UI测试。

I'm doing some mobile UI testing using Selenium in a .Net environment using c#.

我能够做的测试非常成功地使用Chrome移动模拟在纵向模式下,但我不能找到如何把横向模式的仿真。

I'm able to do testing quite successfully using the chrome mobile emulation in portrait mode, but I can not found how to put the emulation in Landscape mode.

我希望能够以编程旋转过程中测试,但通过研究看来这是不可能的呢。

I would like to be able to programmatically rotate during testing but through research it appears this is not possible yet.

在纵向模式下工作。

        ChromeOptions chromeCapabilities = new ChromeOptions();         

        chromeCapabilities.EnableMobileEmulation("Apple iPhone 6");

        ChromeDriverService service = ChromeDriverService.CreateDefaultService(@"C:\chromedriver");            

        IWebDriver driver = new ChromeDriver(service, chromeCapabilities);
        driver.Navigate().GoToUrl("www.google.com");



不过我怎么把iPhone仿真到一个横向?

However how do I put the iPhone emulation in to a landscape orientation?

我也试过,但它简化版,工作和浏览器没有尺寸限制打开

I have tried this but it does't work and the browser opens without the size limitations

        ChromeMobileEmulationDeviceSettings CMEDS = new ChromeMobileEmulationDeviceSettings();
        CMEDS.Width = 66;
        CMEDS.Height = 37;
        CMEDS.PixelRatio = 1.0;
        CMEDS.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25";

        ChromeOptions chromeCapabilities = new ChromeOptions();

        chromeCapabilities.EnableMobileEmulation(CMEDS);

        ChromeDriverService service = ChromeDriverService.CreateDefaultService(@"C:\chromedriver");

        IWebDriver driver = new ChromeDriver(service, chromeCapabilities);
        driver.Navigate().GoToUrl("www.google.com");



任何帮助或建议大受接待!提前
谢谢

Any help or advice greatly received!! Thanks in advance

推荐答案

据我了解,的这是不可能改变屏幕方向的时刻。

From what I understand, it is not possible to change the screen orientation at the moment.

下面是相关的悬而未决的问题:

Here is a related open issue:

  • Support setting screen orientation on mobile device

有的一些和的添加自定义品牌新景观以模拟设备>提示在我开始思考,这也许可以有一个源代码」设备的(如何添加设备编程虽然是一个悬而未决的问题)。

There are some and few hints in the source code that got me thinking that it might be possible to have a "landscape" oriented emulated device by adding a custom brand new device (how to add a device programmatically is an open question though).

这篇关于C#硒Mobile仿真景观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆