Selenium (Python) - SELECT

后端 未结 1 1566
名媛妹妹
名媛妹妹 2020-12-06 10:40

Right now my script go to page and open the second object from the drop down list, \"Vijesti\", before I get the error message.

This is the error:

相关标签:
1条回答
  • 2020-12-06 11:39

    The page refreshes itself when an item is chosen from the dropdown.

    You need to "refind" the select element on each option select:

    select = Select(driver.find_element_by_name('kategorija'))
    
    for index in range(len(select.options)):
        select = Select(driver.find_element_by_name('kategorija'))
        select.select_by_index(index)
    
        # grab the results
    
    0 讨论(0)
提交回复
热议问题