如何在控制台中提醒文本内容 [英] How to alert text content in console

查看:87
本文介绍了如何在控制台中提醒文本内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,这是我的源代码

Hello guys this is my sourcecode

main.container-fluid:nth-child(5)<main class="container-fluid ng-scope" ng-view=""><div class="row ng-scope">
    <section class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">
        <h3 ng-show="searchQuery" class="page-header page-header-sm ng-hide"><span translate="TITLE_SEARCH_RESULTS" class="ng-scope">Search Results</span> <span class="label label-default ng-binding" ng-bind-html="searchQuery"></span></h3>
        <h3 ng-show="!searchQuery" class="page-header page-header-sm ng-scope" translate="TITLE_ALL_PRODUCTS">All Products</h3>

        <div class="alert-info ng-hide" ng-show="confirmation">
            <p class="ng-binding"></p>
        </div>
    </section>
</div></main>

现在我需要一个检查值"All Products"的循环,然后在控制台中写入内容

Now I need a loop that checking for the value"All Products", then write the content in console

这是我的代码

 IList<IWebElement> links = Driver.Instance.FindElements(By.XPath("//h3[@class='page-header page-header-sm ng-scope']"));
         
                IList<IWebElement> listOflinks = new List<IWebElement>();

                for (int i = 0; i < links.Count; i++)
                {
                    links = Driver.Instance.FindElements(By.XPath("//h3[@class='page-header page-header-sm ng-scope']"));

                    if (!string.IsNullOrEmpty(links[i].Text))
                        //links[i].Click();
                        Console.WriteLine(links[i].ToString());
                }

虽然我只是得到结果

though I just get as result

Element (id = c25b9ecd-b828-4353-a9d8-9f8a53b9cee9)

可能有人帮我纠正这个?



提前谢谢你

Could someone help me ot correct this?

Thank you in advance

推荐答案

//you only need to replace this line in your code

Console.WriteLine(links [i] .Text.ToString());

Console.WriteLine(links[i].Text.ToString());





这篇关于如何在控制台中提醒文本内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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