1. 引入select的依赖
  2. 通过Select的方法选中选项
  • select_by_index()根据option索引来定位,从0开始
  • select_by_value()根据option属性value值来定位
  • select_by_visible_text()根据option显示文本来定位

    执行代码

    ```html select = Select(driver.find_element(By.ID,”selectA”)) time.sleep(2) select.select_by_index(3) time.sleep(2) select.select_by_value(“bj”) time.sleep(2) select.select_by_visible_text(“A广州”)

```

调用得API代码

image.png