In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Python Automation: the select tag style= "display: none;" of the drop-down box positioning method
Error
Selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated
Interface source code: (Zen Tao as an example)
Troubleshooting:
1) because it is hidden, it needs to be visible before it can be located.
2) if the location still cannot be located, please check whether there is sleep waiting before and after. The efficiency of xpath positioning will be lower.
The''select tag positioning uses index if manipulating hidden elements:; [js is not needed if it is not hidden] js =' document.querySelectorAll ("select") [0] .style.display = "block"; 'driver.execute_script (js)-document.querySelectorAll ("select") selects all select. [0] specify the number of tags in this set of tags. Style.display= "block"; display= "block" of the modified style to indicate visibility. After executing this js code, you can operate the drop-down box normally.'' # index location; Import: from selenium.webdriver.support.select import Selectjs = 'document.querySelectorAll ("select") [2] .style.display = "block";' # [2]: write driver.execute_script (js) project = driver.find_element_by_xpath ("/ / * [@ id='project']") Select (project). Select_by_index (1) # check the option from zero
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.
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.