1. There are 2 kinds of drop-down boxes, 1 of which can be positioned to the entire drop-down box via F12, and the code HTML to navigate to
<select id= "Ctl00_maincontentplaceholder_noticemanage1_ddlnoticetype" class= "select" Name= "ctl00
$MainContentPlaceHolder $noticemanage1$ddlnoticetype ">
<option value= "0" > Please select </option>
<option value= "8" > Important News </option>
<option value= "9" > Securities News </option>
<option value= "Ten" > Competition rules </option>
<option value= "One" >21212</option>
</select>
In this case, you need to point to the drop-down box and assign a variable, and then use XPath to get the element under the variable and click it, such as:
Se=driver.find_element_by_name ("Ctl00$maincontentplaceholder$ddlmarketindustryreturnindex")
Se.find_element_by_xpath ("//option[@value = ' 3 ']"). Click () 2. Another situation is to be able to navigate to the drop-down button, you need to first navigate to the drop-down button by F12 and click, Then navigate to the optional element via F12 and click
Such as:
Driver.find_element_by_xpath ("//*[@id = ' valide-form ']/tbody/tr[3]/td[2]/span/span/span"). Click () #报价方式下拉按钮
Driver.find_element_by_xpath ("/html/body/div[2]/div/div[2]"). Click () #限价委托
Selenium webdriver drop-down box processing method