def select2Select(self, id, value):
"""Select a value in a select2 menu. The select element *must* have an
id attribute in order for this work. Select2 uses the select element id
to create its container for selections.
"""
selector = '#select2-' + id + '-container + .select2-selection__arrow'
self.waitForClickable((By.CSS_SELECTOR, selector))
self.find(By.CSS_SELECTOR, selector).click()
field = self.waitForPresence((By.CLASS_NAME, 'select2-search__field'))
field.send_keys(value)
field.send_keys(Keys.RETURN)
评论列表
文章目录