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

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

        <tfoot id='wkn3M'></tfoot>

      1. 如何在 Selenium 中获取 WebElement 的 HTML 代码

        How to get HTML code of a WebElement in Selenium(如何在 Selenium 中获取 WebElement 的 HTML 代码)

          • <bdo id='Llozy'></bdo><ul id='Llozy'></ul>
            <tfoot id='Llozy'></tfoot>

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

            • <legend id='Llozy'><style id='Llozy'><dir id='Llozy'><q id='Llozy'></q></dir></style></legend>

                <tbody id='Llozy'></tbody>
            • <i id='Llozy'><tr id='Llozy'><dt id='Llozy'><q id='Llozy'><span id='Llozy'><b id='Llozy'><form id='Llozy'><ins id='Llozy'></ins><ul id='Llozy'></ul><sub id='Llozy'></sub></form><legend id='Llozy'></legend><bdo id='Llozy'><pre id='Llozy'><center id='Llozy'></center></pre></bdo></b><th id='Llozy'></th></span></q></dt></tr></i><div id='Llozy'><tfoot id='Llozy'></tfoot><dl id='Llozy'><fieldset id='Llozy'></fieldset></dl></div>
                  本文介绍了如何在 Selenium 中获取 WebElement 的 HTML 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是测试新手,所以如果我的问题听起来有点初级,我提前道歉.

                  I am new at testing so my apologies in advance if my question sounds a bit primary.

                  我正在使用 Selenium 和 Java 编写测试.

                  I am using Selenium and Java to write a test.

                  我知道webElement.getAttribute("innerHTML"); 给我带来了 innerHTML,例如下面的元素:

                  I know that webElement.getAttribute("innerHTML"); brings me the innerHTML, for example for the element below:

                  <a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" style="position: absolute; border-radius: 0px 0px 4px 4px;">
                      <span class="ui-icon ui-icon-closethick">close</span>
                  </a>
                  

                  它返回:

                  <span class="ui-icon ui-icon-closethick">close</span>
                  

                  但我需要一些能够为我带来 WebElement "a" 内部属性的东西,如下所示:

                  but I need something that brings me the inner attribute of WebElement "a", something like below:

                  href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button" style="position: absolute; border-radius: 0px 0px 4px 4px;"
                  

                  推荐答案

                  如果想要元素本身的HTML,可以使用

                  If you want the HTML of the element itself, you can use

                  webElement.getAttribute("outerHTML");
                  

                  它将返回元素本身的 HTML 以及所有子元素.我不确定这是否正是你想要的.我认为没有办法只获取所选元素的 HTML.

                  It will return the HTML of the element itself plus all the children elements. I'm not sure if that's exactly what you want. I don't think there is a way to just get the HTML of the selected element only.

                  这篇关于如何在 Selenium 中获取 WebElement 的 HTML 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)

                    <bdo id='WeuYI'></bdo><ul id='WeuYI'></ul>
                        <legend id='WeuYI'><style id='WeuYI'><dir id='WeuYI'><q id='WeuYI'></q></dir></style></legend>
                          <tbody id='WeuYI'></tbody>
                        <tfoot id='WeuYI'></tfoot>
                        1. <small id='WeuYI'></small><noframes id='WeuYI'>

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