capybara finds button but clicking it does nothing - ruby

UPDATE: I removed most javascript dependencies and it worked. Don't know what library or code is the evil part, I needed none of it.
simple form, two input fields and a button
fill_in 'cellNumber', :with => '13245678'
fill_in 'password', :with => 'mypass'
click_button('OK')
It finds the button, but nothing happens.
Important!, if I click the myself, everything works as expected.
<button type="submit" id="loginid">OK</button>
</form>
Using ruby-debug, I find that find_button("OK").click returns "". If not found would raise error.
If I click manually inside the firefox window, halting the capybara test with sleep or in debug, I see (test window in focus) a blue frame has appeared around the button , as it's been selected somehow.
Anyway, I'm close to checking in to a mental facility right now... Any suggestions?

Javascript may interfere. The page had some unnecessary dependencies to Squeezebox, Mootools-1.2.5 and Function.cbb.js, so I just removed them and refactored to use more css functionality (like hover) and specialized js. I'm not impressed with this. Nonetheless, I hope this answer would help others.
update: Seems like Mootools is incompatible with Selenium. Without including any other JS library/code than the mootools core library, it breaks. I've tried both 1.2.5-core and 1.3.2-full-compact.

Related

mouse over and click in Capybara

Got stuck in capybara coding. appreciate any help on this.
I need to mouseover on source element to click on the target element link.
Not finding a way to get it. need to use this in chrome browser only.
Tried the code below
source=ses.find('#source-link')
ses.driver.action.move_to(source).perform
ses.find('#child-link').click
If what you're trying to do is hover over #source-link and then click `#child-link' it should just be
sess.find('#source-link').hover
sess.find('#child-link').click
If that doesn't work for you then we need to know exactly what events are triggering the behavior you expect.

Drop-down menu not enabled in IE11 non-compatibility mode

We are migrating the app to IE11 from IE8. Everything in the app works perfectly well, but for the fact that the drop-down menus in the app don't show up. If you hover over it, it does show a "hand" and on clicking then, it does drop down.
So basically the only thing that's missing is the fact that the little arrow for drop-down menus dont' show up, although it functions perfectly well.
Any idea how to correct this and get the drop-down menus to show up like in regular IE8?
PS: I cannot be using the compatibility mode. I would need to use the regular, non-compatibility mode for IE11. Also, it works perfectly well in compatibility mode.
Here is the code bit for the input type:
<input id="retrieveReports_filterReports" dojoType="dijit.form.FilteringSelect" value="" autoComplete="false"
style="width: 350px;" highlightMatch="all" queryExpr="*${0}*" invalidMessage="Please enter a report name, keyword or key."
name="auto_complete" store="reportStore" onchange = "getMatchingReports(this.value.index)"/>
It seems to be using dojo's dijit library.
I am not able to upload pictures to be able to demonstrate this. But hope this helps!
I found the solution. I had to correct a CSS file to change the visibility to inline or visible [both work] for the drop down arrow.
Another way would probably have been if the Dojo version was upgraded, but that was not in scope.

How can I inspect a XUL popup element without it disappearing?

Firefox 31 broke my Googlebar Lite extension, and I'm trying to debug why. My problem is that mouse clicks no longer register for search suggestions that appear in the auto-complete popup menu (which comes as a part of the Firefox autocomplete textbox control). I'd like to inspect these chrome elements with DOM Inspector, but the popup closes (destroying the anonymous children) before I'm able to inspect them.
How can I inspect a popup element (in this case it's a panel) without it disappearing? Is there a way I can force that kind of element to stay open so I can examine its children?
Inspecting the autocomplete DOM would require hacking deeply into the autocomplete code to avoid making it destroy items before inspecting.
While possible, I'd first look if the autocomplete code changed, so I tried:
Finding the result interface on MXR: http://mxr.mozilla.org/mozilla-central/source/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
Checking the log: http://hg.mozilla.org/mozilla-central/filelog/de8c0f0e74a2/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
Checking out the newest changeset(s) and bug(s).
And indeed, Bug 754265 amended the interface.
So I implemented the interface change, implementing the new API method, and after that the broken stuff works again:
getFinalCompleteValueAt: function(index) {
return this._results[index];
},
I made a pull-request for you.
Also try installing addon "Element Inspector" it allows you Shift + Right Click anything and it pops it up in "DOM Inspector"
https://addons.mozilla.org/en-US/firefox/addon/element-inspector/

Solgema.fullcalendar AJAX throws error

Overview
I am running a Plone 4.2.4 server, it is a standalone install and doesn't have any add-ons installed other than Solgema.fullcalendar. Everything installed a-ok (I can see nothing in my buildout output regarding errors or missing dependencies and running my instance in foreground mode shows no problems).
Buildout
Inside of my buildout I have: (as they request on this link)
eggs =
[...]
Solgema.fullcalendar
zcml =
[...]
Solgema.fullcalendar
Process
I followed the instructions in the documentation, going to Add New... > Collection
Then on my collection selecting View > Solgema Fullcalendar
I leave the Calendar Properties tab alone and besides changing the view to `Month' everything else remains the same.
Problem
When clicking on a blank date block, I see a little spinner.gif signifying something is loading, but in my Javascript console I see:
Error: uncaught exception: cannot call methods on dialog prior to initialization;
attempted to call method 'destroy'
This happens via the right click menu also, the right click menu loads but throws the above error once I click any of the buttons contained in it.
I can drag events, and resize them without any problems (however I think something is missing as after either dragging or resizing the event, the browser takes me to the page for that event).
Summary
It seems like I'm missing a Javascript file that was not included in Solgema.fullcalendar however I have no idea what script it was and I am unable to decipher this Javascript error (above).
If anyone has any experience with this, ideas or your thoughts would be greatly appreciated.

Selenium RC : Button is not clicked but test passes

I have a script which enters some data in the page and click save button.
Here I used HTML component id for save button.
selenium.click("StudentID:saveData");
I even provided proper wait condition and also tried with X path locator.
The test passes. It doesn't throw any error message but the button is not clicked and the data is not getting updated.
Please let me know what might be the issue .
I had a similar problem and used a CSS selector instead. CSS selectors are much faster than Xpath (and in my experience work better in general, though Xpath is necessary for certain things).
If you are using Firefox, install the Firebug add-on; right-clicking on an element on the page will give you the option to copy CSS path. I've found that I often have to make some changes to it to get it working properly but it allows you to get to very deeply nested elements quickly.
The W3C has a good page on CSS selectors here.

Resources