diff --git a/behat/features/panopoly_magic/add_content_preview.feature b/behat/features/panopoly_magic/add_content_preview.feature
index 266d0e6..83159aa 100644
--- a/behat/features/panopoly_magic/add_content_preview.feature
+++ b/behat/features/panopoly_magic/add_content_preview.feature
@@ -49,7 +49,7 @@ Feature: Preview of widgets on 'Add content' dialog
       And I click "Add new pane"
       And I click "Panopoly Test" in the "CTools modal" region
     Then I should not see "Abracadabra! Here is a simple pane."
-      And I should see "Add Simple Pane" in the "div" element with the "class" attribute set to "panopoly-magic-preview-title" in the "CTools modal" region
+      And I should see the link "Preview Simple Pane widget" in the "CTools modal" region
     When I click "Preview Simple Pane widget" in the "CTools modal" region
     Then I should see "Abracadabra! Here is a simple pane."
     When I click "A simple pane for testing." in the "CTools modal" region
@@ -70,7 +70,7 @@ Feature: Preview of widgets on 'Add content' dialog
     # Check for signs of the automatic preview
     Then I should not see "Abracadabra! Here is a simple pane."
     # ... and manual preview
-    And I should not see "Add" in the "div" element with the "class" attribute set to "panopoly-magic-preview-title" in the "CTools modal" region
+    And I should not see the link "Preview Simple Pane widget" in the "CTools modal" region
     # ... and the single preview
     And I should not see "Select a widget to show its preview"
     # Finally, make sure the add link still works
diff --git a/behat/features/panopoly_magic/livepreview.feature b/behat/features/panopoly_magic/livepreview.feature
index 5ed65cd..c6d5bd1 100644
--- a/behat/features/panopoly_magic/livepreview.feature
+++ b/behat/features/panopoly_magic/livepreview.feature
@@ -334,7 +334,7 @@ Feature: Live preview
       And I press "Update Preview"
     Then I should not see "Widget content 1" in the "Live preview" region
       And I should see "THIS WILL BE CANCELLED" in the "Live preview" region
-    When I click "Close Window"
+    When I click "Close Window" link or button
       And I click "Edit" in the "Boxton Content" region
     Then I should see "Widget content 1" in the "Live preview" region
     When I fill in the "edit-field-basic-text-text-und-0-value" WYSIWYG editor with "Widget content 2"
diff --git a/behat/features/panopoly_magic/seldom_used_panes.feature b/behat/features/panopoly_magic/seldom_used_panes.feature
index 38756fd..1f3a9c7 100644
--- a/behat/features/panopoly_magic/seldom_used_panes.feature
+++ b/behat/features/panopoly_magic/seldom_used_panes.feature
@@ -22,7 +22,7 @@ Feature: Panopoly Magic allows the admin to toggle displaying seldom used pane s
       And I should see "Testing text body field"
     When I click "Style" in the "Boxton Content" region
     Then I should see "No markup at all"
-    Then I click "Close window"
+    Then I click "Close Window" link or button
       And I press "Save"
       And I wait for the Panels IPE to deactivate
 
@@ -45,6 +45,6 @@ Feature: Panopoly Magic allows the admin to toggle displaying seldom used pane s
       And I should see "Testing text body field"
     When I click "Style" in the "Boxton Content" region
     Then I should not see "No markup at all"
-    Then I click "Close window"
+    Then I click "Close Window" link or button
       And I press "Save"
       And I wait for the Panels IPE to deactivate
diff --git a/behat/steps/panopoly_test.behat.inc b/behat/steps/panopoly_test.behat.inc
index 01fb66b..7f345d9 100644
--- a/behat/steps/panopoly_test.behat.inc
+++ b/behat/steps/panopoly_test.behat.inc
@@ -553,6 +553,25 @@ class TestSubContext extends RawDrupalContext implements DrupalSubContextInterfa
   }
 
   /**
+   * @When I click :text link or button
+   */
+  public function iClickLinkOrButton($text) {
+    $link = $this->getSession()->getPage()->findLink($text);
+    if ($link !== NULL) {
+      $link->click();
+      return;
+    }
+
+    $button = $this->getSession()->getPage()->findButton($text);
+    if ($button !== NULL) {
+      $button->press();
+      return;
+    }
+
+    throw new \Exception(sprintf('The link or button "%s" was not found on the page %s', $text, $this->getSession()->getCurrentUrl()));
+  }
+
+  /**
    * @Then I should see :text in the :tag element in the :region region
    */
   public function assertRegionElementText($text, $tag, $region) {
@@ -698,7 +717,7 @@ class TestSubContext extends RawDrupalContext implements DrupalSubContextInterfa
     if ($div) {
       $radios = $div->find('xpath', "//input[@type='radio']");
       if ($radios) {
-        $checkedRadio = $div->find('xpath', "//input[@type='radio' and @checked='checked']/following-sibling::label[contains(text(), '$option')] ");
+        $checkedRadio = $div->find('xpath', "//input[@type='radio' and @checked='checked' and @id=(//label[contains(., '$option')]/@for)] ");
         if (!$checkedRadio) {
           throw new \Exception(sprintf('We found the radio buttons for "%s", but "%s" was not selected.', $field, $option));
         }
