Behat I press "Button" not working

Dharmalingam Arumugam picture Dharmalingam Arumugam · Jul 4, 2013 · Viewed 8.1k times · Source

I have a submit button namely “Log In” in the login form . The input field is looks like bellow

<input name="submit" type="submit" value="Log In">

When I press the button “Log In” for submit the login form I am getting the following error

    Exception thrown by (//html/.//input[./@type = 'submit' or ./@type = 'image' or ./@type = 'button'][(((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(./@title, 'submit'))] | .//input[./@type = 'image'][contains(./@alt, 'submit')] | .//button[((((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(normalize-space(string(.)), 'submit')) or contains(./@title, 'submit'))] | .//input[./@type = 'image'][contains(./@alt, 'submit')] | .//*[./@role = 'button'][(((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(./@title, 'submit') or contains(normalize-space(string(.)), 'submit'))])[1]
Element must be displayed to click (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 44 milliseconds
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows Server 2008 R2', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35'
Session ID: a5c41be673ac14346462e1bf99f60995
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=27.0.1453.110, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]

My steps like bellow

  Given I am on "/"
  And I wait for "Log In"
  And I hover on "Log In"
  And I wait for "Log In"   
  When I fill in "LoginForm_username" with my username
  And I fill in "LoginForm_password" with my password
  And I press "submit"

Answer

Dharmalingam Arumugam picture Dharmalingam Arumugam · Jul 8, 2013

I have modified the code as bellow it's working now

$page = $this->getSession()->getPage();
$element = $page->find('css',"#formid input[value=\"Log In\"]");
$element->doubleClick();