In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how selenium grabs elements to exclude a specific class tag, I hope you will learn something after reading this article, let's discuss it together!
Excluding a certain factor, the first priority is to think of regular expressions, but it does not succeed for a long time. It feels like selenium is operating on the element's attrs by pressing re search, and $is useless for string end detection.
BeautifulSoup can be detected with the class of the element ['class'] output element, but the BeautifulSoup object can no longer click and does not meet expectations. Selenium does not have such a syntax, so choose through xpath:
ItemList = driver.find_elements_by_xpath ('/ / div [@ id = "choose-color"] / / div [@ class = "dd"] / / div [not (contains (@ class, "disabled"))]')
Stackoverflow has a reference: http://stackoverflow.com/questions/11024080/how-to-use-not-contains-in-xpath
Supplementary xpath usage:
Xpath=xpathExpression: Locate an element using an XPath expression. Xpath=//img [@ alt='The image alt text'] xpath=//table [@ id='table1'] / / tr [4] / td [2] xpath=//a [contains (@ href,'#id1')] xpath=//a [contains (@ href) '# id1')] / @ class xpath= (/ / table [@ class='stylee']) / / th [text () =' theHeaderText'] /.. / td xpath=//input [@ name='name2' and @ value='yes'] xpath=//* [text () = "right"] has finished reading this article I believe you have a certain understanding of "how selenium crawls elements to exclude a specific class tag". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 271
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.