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

    <small id='3SKmV'></small><noframes id='3SKmV'>

    • <bdo id='3SKmV'></bdo><ul id='3SKmV'></ul>

    1. <legend id='3SKmV'><style id='3SKmV'><dir id='3SKmV'><q id='3SKmV'></q></dir></style></legend>
        <tfoot id='3SKmV'></tfoot>

        WebDriver 从页面中删除元素

        WebDriver remove element from page(WebDriver 从页面中删除元素)
          <bdo id='DgaPj'></bdo><ul id='DgaPj'></ul>
          <tfoot id='DgaPj'></tfoot>
          <i id='DgaPj'><tr id='DgaPj'><dt id='DgaPj'><q id='DgaPj'><span id='DgaPj'><b id='DgaPj'><form id='DgaPj'><ins id='DgaPj'></ins><ul id='DgaPj'></ul><sub id='DgaPj'></sub></form><legend id='DgaPj'></legend><bdo id='DgaPj'><pre id='DgaPj'><center id='DgaPj'></center></pre></bdo></b><th id='DgaPj'></th></span></q></dt></tr></i><div id='DgaPj'><tfoot id='DgaPj'></tfoot><dl id='DgaPj'><fieldset id='DgaPj'></fieldset></dl></div>
        • <legend id='DgaPj'><style id='DgaPj'><dir id='DgaPj'><q id='DgaPj'></q></dir></style></legend>

                <tbody id='DgaPj'></tbody>

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

                  本文介绍了WebDriver 从页面中删除元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Selenium WebDriver(ChromeDriver).处理后我需要从页面中删除一些元素(来自 DOM 模型).

                  I'm using Selenium WebDriver(ChromeDriver). I need to remove some elements from page after processing(from DOM model).

                  例如我有以下元素:

                  WebElement starRatingElement = reviewElement.findElement(By.className("review-info-star"));
                  

                  如何从浏览器 DOM 模型中移除 starRatingElement ?

                  How to remove starRatingElement from browser DOM model ?

                  如何使用 Selenium WebDriver 在 Java 中实现?请举个例子.

                  How it can be achieved in Java with Selenium WebDriver ? Please show an example.

                  推荐答案

                  您必须执行 JavaScript 代码才能进行任何 DOM 更改.

                  You'll have to execute a JavaScript code to make any DOM changes.

                  WebDriver driver = new ChromeDriver();
                  JavascriptExecutor js;
                  if (driver instanceof JavascriptExecutor) {
                      js = (JavascriptExecutor) driver;
                  }
                  js.executeScript("return document.getElementsByClassName('review-info-star')[0].remove();");
                  

                  这篇关于WebDriver 从页面中删除元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

                  <tfoot id='oAB6a'></tfoot>
                        <bdo id='oAB6a'></bdo><ul id='oAB6a'></ul>

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

                            <legend id='oAB6a'><style id='oAB6a'><dir id='oAB6a'><q id='oAB6a'></q></dir></style></legend>
                              <tbody id='oAB6a'></tbody>