playwright下拉框处理
# 通过标签的value属性进行选择选项 element.select_option("blue") # 通过标签的label属性进行选择选项 element.select_option(label="blue") # multiple selection element.select_option(value=["red", "green", "blue"]) # 通过文本进行选择选项xpath=元素位置,optiontext是选项的文本内容 element.query_selector("xpath").select_option("optiontext")
在选项没有lable和value属性的时候可以使用最后一个进行选择
# single selection matching the valueelement.select_option("blue")
# single selection matching both the label
element.select_option(label="blue")
# multiple selection
element.select_option(value=["red","green","blue"])