首页 > 解决方案 > 没有选择语句的下拉列表 - 能够单击值,但未设置值

问题描述

我试图从没有“选择”标签的下拉列表中选择多个值。使用下面的代码,我试图从下拉列表中选择 2 个值(追加销售,价格增加),并且我成功地点击了它。但问题是没有选择值并且它只是突出显示值突出显示但未设置并且控件不会转到另一个对象,比如页面中提到的 GO 按钮。请参阅附件,期望值是这样的点击后期望值是这种方式

driver.find_element_by_xpath("//div[contains(@id,'select-cBooking_Type_NL_CS_US')]").click()
OppType=driver.find_elements_by_xpath("//*[@id='menu-Booking_Type_NL_CS_US']/div[3]/ul/li")
for e in OppType:
   if e.text == 'Upsell' or e.text == 'Price Increase':
        e.click()
driver.find_element_by_xpath("//span[contains(text(),'GO')]").click()

标签: pythonselenium

解决方案


推荐阅读