<legend id='Mipsd'><style id='Mipsd'><dir id='Mipsd'><q id='Mipsd'></q></dir></style></legend>

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

    • <bdo id='Mipsd'></bdo><ul id='Mipsd'></ul>

      <tfoot id='Mipsd'></tfoot>
    1. <i id='Mipsd'><tr id='Mipsd'><dt id='Mipsd'><q id='Mipsd'><span id='Mipsd'><b id='Mipsd'><form id='Mipsd'><ins id='Mipsd'></ins><ul id='Mipsd'></ul><sub id='Mipsd'></sub></form><legend id='Mipsd'></legend><bdo id='Mipsd'><pre id='Mipsd'><center id='Mipsd'></center></pre></bdo></b><th id='Mipsd'></th></span></q></dt></tr></i><div id='Mipsd'><tfoot id='Mipsd'></tfoot><dl id='Mipsd'><fieldset id='Mipsd'></fieldset></dl></div>
      1. Selenium Select - 通过部分文本选择下拉选项

        Selenium Select - Selecting dropdown option by part of the text(Selenium Select - 通过部分文本选择下拉选项)
        <tfoot id='oHtN4'></tfoot>

          <bdo id='oHtN4'></bdo><ul id='oHtN4'></ul>

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

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

              • <legend id='oHtN4'><style id='oHtN4'><dir id='oHtN4'><q id='oHtN4'></q></dir></style></legend>
                • 本文介绍了Selenium Select - 通过部分文本选择下拉选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  类 Selenium Select 有 3 种不同的选项选择方法:

                  The class Selenium Select has 3 methods of different option selection:

                  1. 选择索引
                  2. 按值选择
                  3. selectByVisibleText

                  现在,我有一种情况,我想通过一些文本选择一个选项,该文本部分出现在选项可见文本之一中(不想让自己暴露于整个文本中的更改).

                  Now, I have a situation where I want to select an option by some text that partially appear in one of the options visible text (don't want to expose myself to changes in the WHOLE text).

                  例如:

                  <option value="0" label="not-intresting">VERY-LONG-TEXT-THAT-I-NEED-TO-SELECT-DOLLAR</option>
                  

                  我只想通过提供DOLLAR"来选择此选项,例如:

                  And i want to select this option only by providing the "DOLLAR", something like:

                  select.selectByPartOfVisibleText("DOLLAR") 
                  

                  您将如何有效地实施它?

                  How would you implement it effectively?

                  推荐答案

                  你可以试试这样的逻辑,希望对你有帮助

                  You can try a logic like this hope this helps

                  List <WebElements> optionsInnerText= driver.findElements(By.tagName("option"));
                  for(WebElement text: optionsInnerText){
                      String textContent = text.getAttribute("textContent");
                      if(textContent.toLowerCase.contains(expectedText.toLowerCase))
                             select.selectByPartOfVisibleText(expectedText);
                      }
                  }
                  

                  这篇关于Selenium Select - 通过部分文本选择下拉选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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如何按不区分大小写进行搜索)

                • <legend id='BIYkB'><style id='BIYkB'><dir id='BIYkB'><q id='BIYkB'></q></dir></style></legend>
                    <tfoot id='BIYkB'></tfoot>

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

                      <tbody id='BIYkB'></tbody>

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