Selenium analog search I search is always unable to locate the label, no problem.

class qichacha:
     def __init__(self):
         option = webdriver.ChromeOptions()
         option.add_argument("--start-maximized")  -sharp 
         option.add_argument("--headless")  -sharp 
         self.driver = webdriver.Chrome(chrome_options=option)
         self.serarch_engine_url="https://www.qichacha.com/"
         self.csv_file = os.getcwd() +"/"+"data.csv"
     def search_index(self):

         self.driver.get("https://www.qichacha.com/")
         response = self.driver.page_source.encode("utf-8")
         print(response)
         self.driver.find_element_by_id("searchkey").send_keys("")

         self.driver.find_element_by_id("V3_Search_bt").click()

         response=self.driver.page_source.encode("utf-8")
         
       
         

clipboard.png

Mar.18,2021

the tag you want to locate should be generated asynchronously through js, so you can't locate it. Try it for a while

Menu