Selenium/Protractor .NET test hangs when using BrowserStack iPhone on remote website

点点圈 提交于 2019-12-25 03:59:15

问题


I'm having issues testing iPhone on BrowserStack with tests written in C# with Selenium and Protractor-net.

The test starts running and after it opens the webpage to my website, it just hangs and never moves on to the StringAssert step. There are no errors when this happens. I must manually stop my test and the session in BrowserStack to continue.

I tried turning on logging from within BrowserStack's capabilities, but no errors are returning and the console log is empty. I've tried multiple configs of iPhones too.

Note, this sample test works fine with Android Google Pixel 2 and Windows 10 testing on BrowserStack, just iPhone's are giving me this problem.

Here is my sample test:

class Class1
{
    [Test]
    public static void FirstTest()
    {
        IWebDriver driver;
        DesiredCapabilities capability = new DesiredCapabilities();
        capability.SetCapability("browserName", "iPhone");
        capability.SetCapability("device", "iPhone 6S");
        capability.SetCapability("realMobile", "true");
        capability.SetCapability("os_version", "11.4");
        capability.SetCapability("browserstack.console", "errors");
        capability.SetCapability("browserstack.user", "");
        capability.SetCapability("browserstack.key", "");

        driver = new RemoteWebDriver(new Uri("http://hub-cloud.browserstack.com/wd/hub/"), capability);
        driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(10);

        NgWebDriver ngdriver = new NgWebDriver(driver);
        ngdriver.Navigate().GoToUrl("https://myproduction.website/");
        StringAssert.Contains("MyTitle", ngdriver.Title);

        NgWebElement query = ngdriver.FindElement(NgBy.Model("employeeCode"));
        query.Clear();
        query.SendKeys("Browserstack");
        Console.WriteLine(ngdriver.Title);
        ngdriver.Quit();
    }
}

回答1:


I understand you are running Protractor tests on real iOS devices. Protractor injects JavaScripts using execute_async method. The execute_async method is not fully supported by Appium due to which you may be seeing failures. You will find more details on the issue at the links below:

  • https://github.com/angular/protractor/issues/2840
  • https://github.com/angular/protractor/issues/1736


来源:https://stackoverflow.com/questions/51562359/selenium-protractor-net-test-hangs-when-using-browserstack-iphone-on-remote-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!