1

How can I bypass this and select the value I need?

behat #selenium2 #drupal7

When I select "male" from "profile_additional[field_gender][und]"

     /**
     * @When /^I check the "([^"]*)" radio button$/
     */
     public function iCheckTheRadioButton($labelText)
         {
         foreach ($this->getMainContext()->getSession()->getPage()->findAll('css', 'label') as $label) {
             if ($labelText === $label->getText() && $label->has('css', 'input[type="radio"]')) {
                 $this->getMainContext()->fillField($label->find('css', 'input[type="radio"]')->getAttribute('name'), $label->find('css', 'input[type="radio"]')->getAttribute('value'));
                 return;
             }
         }
         throw new \Exception('Radio button not found');
     }

Drupal\DrupalExtension\Context\MinkContext::selectOption() unknown error: Element is not clickable at point (547, 470). Other element would receive the click: ... (Session info: chrome=74.0.3729.131) (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 10.0.17763 x86_64) (WebDriver\Exception\UnknownError)

Rot-man
  • 18,045
  • 12
  • 118
  • 124
  • You need to wait for the element first, to make sure is present, after that to wait until is visible/clickable and then click it. Also you have click/check actions, the step says radio button and you are using fillField, does't make sense; + use page objects. – lauda May 08 '19 at 14:36

2 Answers2

0

The element you are trying to interact with is hidden beneath some other element. You can try using Actions to first move to your element, then try to interact with it. Now I am not an expert in PHP and I think this is the language you are using, the action should look something like this:

$action = new WebDriverActions($this->driver); 
$action->moveToElement($element)->click()->perform();

If you know what element is causing this behaviour, then you can also try waiting for it to be gone, usually done via waiting for style attribute to contain none as in display:none

Moro
  • 781
  • 4
  • 14
-1

Better to use scroll to web element using javascript executor

JavascriptExecutor jse = (javascriptExecutor)driver; jse.executeScript("arguments[0].scrollIntoView();"element)

This will resolve your issue