2c2 < index f8555fd..c40b883 100644 --- > index f8555fd..5c4821a 100644 167c167 < + $select = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]', [':data_drupal_selector' => $drupal_selector]); --- > + $select = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector and contains(@required, "required")]', [':data_drupal_selector' => $drupal_selector]); 183c183 < index b0efbe5..b9200a4 100644 --- > index 9eda1c5..8d6c211 100644 186c186,198 < @@ -1163,8 +1163,7 @@ protected function assertNoFieldChecked($id, $message = '', $group = 'Browser') --- > @@ -1173,8 +1173,8 @@ protected function assertNoFieldChecked($id, $message = '', $group = 'Browser') > /** > * Asserts that a select option in the current page exists. > * > - * @param string $id > - * ID of select field to assert. > + * @param string $drupal_selector > + * The data-drupal-selector of the field to assert. > * @param string $option > * Option to assert. > * @param string $message > @@ -1190,16 +1190,15 @@ protected function assertNoFieldChecked($id, $message = '', $group = 'Browser') > * @return bool 189c201 < protected function assertOption($id, $option, $message = '', $group = 'Browser') { --- > - protected function assertOption($id, $option, $message = '', $group = 'Browser') { 192c204,205 < + return $this->assertOptionWithDrupalSelector($id, $option, $message, $group); --- > + protected function assertOption($drupal_selector, $option, $message = '', $group = 'Browser') { > + return $this->assertOptionWithDrupalSelector($drupal_selector, $option, $message, $group); 196c209,229 < @@ -1213,9 +1212,9 @@ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $me --- > * Asserts that a select option in the current page exists. > * > * @param string $drupal_selector > - * The data drupal selector of select field to assert. > + * The data-drupal-selector of the field to assert. > * @param string $option > * Option to assert. > * @param string $message > @@ -1223,8 +1222,8 @@ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $me > /** > * Asserts that a select option in the current page does not exist. > * > - * @param string $id > - * ID of select field to assert. > + * @param string $drupal_selector > + * The data-drupal-selector of the field to assert. > * @param string $option > * Option to assert. > * @param string $message > @@ -1240,17 +1239,16 @@ protected function assertOptionWithDrupalSelector($drupal_selector, $option, $me > * @return bool 199c232 < protected function assertNoOption($id, $option, $message = '', $group = 'Browser') { --- > - protected function assertNoOption($id, $option, $message = '', $group = 'Browser') { 203,205c236,238 < + $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $id, ':option' => $option)); < + return $this->assertFalse(isset($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector exists.', array('@option' => $option, '@data_drupal_selector' => $id)), $group); < + --- > + protected function assertNoOption($drupal_selector, $option, $message = '', $group = 'Browser') { > + $options = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $drupal_selector, ':option' => $option)); > + return $this->assertFalse(isset($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector exists.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group); 209c242,252 < @@ -1241,8 +1240,7 @@ protected function assertNoOption($id, $option, $message = '', $group = 'Browser --- > * Asserts that a select option in the current page is checked. > * > - * @param string $id > - * ID of select field to assert. > + * @param string $drupal_selector > + * The data-drupal-selector of the field to assert. > * @param string $option > * Option to assert. > * @param string $message > @@ -1268,9 +1266,8 @@ protected function assertNoOption($id, $option, $message = '', $group = 'Browser > * 212c255 < protected function assertOptionSelected($id, $option, $message = '', $group = 'Browser') { --- > - protected function assertOptionSelected($id, $option, $message = '', $group = 'Browser') { 215c258,259 < + return $this->assertOptionSelectedWithDrupalSelector($id, $option, $message, $group); --- > + protected function assertOptionSelected($drupal_selector, $option, $message = '', $group = 'Browser') { > + return $this->assertOptionSelectedWithDrupalSelector($drupal_selector, $option, $message, $group); 219c263,275 < @@ -1293,8 +1291,8 @@ protected function assertOptionSelectedWithDrupalSelector($drupal_selector, $opt --- > @@ -1303,8 +1300,8 @@ protected function assertOptionSelectedWithDrupalSelector($drupal_selector, $opt > /** > * Asserts that a select option in the current page is not checked. > * > - * @param string $id > - * ID of select field to assert. > + * @param string $drupal_selector > + * The data-drupal-selector of the field to assert. > * @param string $option > * Option to assert. > * @param string $message > @@ -1320,9 +1317,9 @@ protected function assertOptionSelectedWithDrupalSelector($drupal_selector, $opt > * @return bool 222c278 < protected function assertNoOptionSelected($id, $option, $message = '', $group = 'Browser') { --- > - protected function assertNoOptionSelected($id, $option, $message = '', $group = 'Browser') { 225,226c281,283 < + $elements = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $id, ':option' => $option)); < + return $this->assertFalse(isset($elements[0]) && !empty($elements[0]['selected']), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector is selected.', array('@option' => $option, '@data_drupal_selector' => $id)), $group); --- > + protected function assertNoOptionSelected($drupal_selector, $option, $message = '', $group = 'Browser') { > + $elements = $this->xpath('//select[@data-drupal-selector=:data_drupal_selector]//option[@value=:option]', array(':data_drupal_selector' => $drupal_selector, ':option' => $option)); > + return $this->assertFalse(isset($elements[0]) && !empty($elements[0]['selected']), $message ? $message : SafeMarkup::format('Option @option for field @data_drupal_selector is selected.', array('@option' => $option, '@data_drupal_selector' => $drupal_selector)), $group);