【问题标题】:How do i figure out what to use for my If statement. When I want to identify I am using Browserstack我如何弄清楚我的 If 语句使用什么。当我想识别我正在使用 Browserstack
【发布时间】:2021-11-08 18:45:46
【问题描述】:

Browserstack 使用这个 uri http:/hub-cloud.browserstack.com/wd/hub。在本地我使用http://xxx.xxx.xx.xxx:xxxx/wd/hub。我尝试将它们放入,但出现错误我还尝试使用 Browserstack(这是 Browserstack 设置代码)为 FI 获取布尔值,所以我有以下内容。 if(位置)应该是什么

if (Location)
    {
        var foundElement = (_IOSdriver.FindElementsByXPath(elementXPath));
        Assert.IsNotNull(foundElement);
        // Browserstack Check;
    }
    else
    {
        IReadOnlyList<IOSElement> allTextViewElements =
            _IOSdriver.FindElementsByXPath(elementXPath);

        //Setting the status of test as 'passed' or 'failed' based on the condition if results are found for the search

        if ((allTextViewElements.Count > 0))
        {
            ((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \" Results found! \"}}");
        }
        else
        {
            ((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \" Results not found!\"}}");
        }

【问题讨论】:

    标签: c# appium browserstack


    【解决方案1】:

    答案是添加

    var isbrowserstackrunning =false;
    if (isBrowserstackrunning !=true)
    {local stuff here including the capabilities you use locally}
    else
    {BrowserStack here including the capabilities you use for Browserstack.}
    

    【讨论】:

    • 这应该是 C# 代码吗?它不会为我编译。
    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    • 它是 C# 并且应该编译它对我有用。 () 表明您可以将其标记为真或假。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-23
    相关资源
    最近更新 更多