In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 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: 0
*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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
1. Install the kvmcentos7 command 2. To install wok, you must open it first.
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.