Behat works fine but PhantomJS fails on dropdown menu when trying to click


Gherkin below works fine with behat but when I use PhantomJS I get error on When I follow "Profile" line below:

Note: The element is a dropdown menu from bootstrap so it toggles after click.


Exception thrown by (//html/.//a[./@href][(((./@id = 'Profile' or contains(normalize-space(string(.)), 'Profile')) or contains(./@title, 'Profile') or contains(./@rel, 'Profile')) or .//img[contains(./@alt, 'Profile')])] | .//*[./@role = 'link'][((./@id = 'Profile' or contains(./@value, 'Profile')) or contains(./@title, 'Profile') or contains(normalize-space(string(.)), 'Profile'))])[1] {"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept-Encoding":"gzip,deflate","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:5140","User-Agent":"Apache-HttpClient/4.3.4 (java 1.5)"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1412065547042\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/5b7c0830-487b-11e4-adc0-a162f25e4a98/element/%3Awdc%3A1412065547042/click"}}


When I follow "Profile" And I follow "Edit"


<ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Profile <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="#">Show</a></li> <li><a href="#">Edit</a></li> </ul> </li> </ul>


I've discovered why and solved with a small fix as shown below.

When using Bootstrap, the menus get squashed down and only an icon appears to represent the same menu which is the normal behaviour for responsive design. All fine for now but when PhantomJS is run, it cannot find the text it is looking for. e.g. "Profile" menu in my case.

<strong>Original state of the menu, which always works fine:</strong>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/wX2LD.png" data-original="https://i.stack.imgur.com/wX2LD.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

<strong>After squashed down version which causes PhantomJS to fail:</strong>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/ctVtK.png" data-original="https://i.stack.imgur.com/ctVtK.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />


Just set the window size to something bigger so that the menu doesn't get squashed down when testing. You can change the screen size from 1024X768 to something else as you wish.

#symfony/src/Site/CommonBundle/Features/Context/FeatureContext.php /** * @BeforeStep */ public function beforeStep() { $this->getSession()->resizeWindow(1024, 768, 'current'); }


  • Cannot establish BLE connection between Android 5 and BLE device
  • JENKINS: ERROR when I try to use an older JDK for a specific maven project
  • Fail SonarQube quality gate when coverage decreases
  • WSO2 ESB 4.0.3 - Error installing Data Services feature from 4.0.* repositories
  • How to make http call with file in groovy to upload a file and build arguments
  • How to set the navigation bar to the top in Table View?
  • Android NFC read Tags issue. Activity starts each time on data received
  • openssl handshake failed
  • How to resolve docker host names (/etc/hosts) in containers
  • Partial specialization of a class template in derived class affects base class
  • Varnish/Apache Random 503 Errors
  • CORS with socket.io
  • File extension of zlib zipped html page?
  • iOS Cordova first plugin - plugin.xml to inject a feature
  • mave 3.2 not able to access local nexus instance return 502 code
  • I am receiving HibernateException “No Hibernate Session bound to thread, and configuration does not
  • MySQL: Update rows in table by iterating and joining with another one
  • Javascript CORS - No 'Access-Control-Allow-Origin' header is present
  • Sending cookie value via httpget but not getting the desired response
  • Tomcat memory Leak
  • JBoss External Properties Files in Classpath
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Problem deserializing objects from cache on MyBatis 3/Java
  • Play WS (2.2.1): post/put large request
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • Jquery UI tool tip close icon
  • Cannot resolve symbol 'MyApi'
  • Seeking advice on Jetty HttpClient Hang
  • Cannot connect to cassandra from Spark
  • Different response to non-authenticated users and AJAX calls
  • How do I fake an specific browser client when using Java's Net library?
  • SSO with signing and signature validation doesn't work
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • need help with bizarre java.net.HttpURLConnection behavior
  • Authorize attributes not working in MVC 4
  • Is it possible to post an object from jquery to bottle.py?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF