Watir can´t access zk element with z-index>0 - watir

I´m testing a zk application. I´m trying to click an option on combobox by its text.
So I'm not get that bacause thah option is inside a div with z-index=88000.
when I check visibility from that div, returns false.
I tried to change z-index via javascript code for 0.
I used the following code:
browser.execute_script("document.getElementByClass('z-combobox-pp')[5].style.zIndex='0';")
but I didn't get it. I got that error:
document.getElementByClassName is not a function (Selenium::WebDriver::Error::JavascriptError)

I cannot explain the z-index issue.
However, the javascript error is occurring because the getElementByClass method does not exist. It should be getElementsByClass (notice the 's' in 'Elements').
Try changing the z-index with:
browser.execute_script("document.getElementsByClass('z-combobox-pp')[5].style.zIndex='0';")

Related

BluePrism Spy element uniquely

I am spying one button from one browser based application. But I am getting the error saying more than one item found.
I am able to spy it only under the Accessibility Mode.
Although,I can see in my page that there is only one element in my page.
How to refer my element uniquely under Accessibility Mode as there is no exact path to specify.
If you are not able to see the elements, but Blue Prism is saying that there is more than one element found, then you may have unchecked these two attributes:
Visible
Screen Visible
Try setting them as "True", and please check if that will help with your problem.
Different approach would be to use one of these two:
Match Index
Ordinal
In a nutshell, they tell Application modeller about which item should be used, if there are multiple similar object visible.
I think it happens when you are having two fields having same properties like in a login page, username & password have same properties when you spy these elements using Blue Prism it shows the error.So, to get rid of that error, check the box ordinal in the application modeller popup(which opens after clicking ctrl+left click) after you've spied the element.I hope you got it.
Whenever we spy elements it is recommended to uncheck few attributes like parent url, input identifier, title etc.
"if there is an error stating that more than one matching window found" then at this point we have to uncheck "windows text" and check the ordinal attribute.
Please try below in Application module
Uncheck the checkbox with empty values
Uncheck the ParentURL.
You just need to check the Match Index and Ordinal property of the spied element. Ordinal will always gives you the unique element on the screen.
This is even mentioned in Blue Prism's Training module.
For Browser/Web-based application, Ordinal Attribute cant not be found.
To Spy the exact element, you can also use "Application Navigator" or UI Automation Navigator.

set focus on mdl-textfield after reload

I'm using the autofocus attribute for mdl-textfield, however after navigating to another page and returning to the target page, the focus on mdl-textfield is lost.
I tried this approach:
Angular2 - Focusing a textbox on component load.
However it valid only for DOM elements such as .
I undrestood that if i want to get focus after navigating away and returning, I have to do it on ngAfterViewInit() method?
Any help, How can i do that?
Thanks

Unable to check the checkbox in GEB

I am trying to check my check box in Geb.
I have tried following codes, but no luck
$('input', type:'checkbox', id: 'chkTermsConditions', tabindex: '-1').value('true')
$(".CheckBoxUI").value('true')
Following is the HTML
After mouse go over the check box additional text updated (marked in the screen shot)
You are attempting to check the box which has the attribute with value='true'
From the Geb manual:
The value of input, select and textarea elements can be retrieved and set with the value method. Calling value() with no arguments will return the String value of the first element in the Navigator. Calling value(value) will set the current value of all elements in the Navigator. The argument can be of any type and will be coerced to a String if necessary. The exceptions are that when setting a checkbox value the method expects a boolean (or, an existing checkbox value) and when setting a multiple select the method expects an array or Collection of values.
Try this:
$("#chkTermsConditions").value(true)
If you are using non standard HTML generated by some other platform. You may have to resort to clicking the element or using javascript.
The element that produces the desired click result could be one of the surrounding elements. If the widget is javascript controlled you may have to call a function that is embedded into the page for that widget. If its a javascript widget I cannot help you unless you can point me to a page which uses the same platform.
Try:
$('a[class=CheckRadioFocus]').click()
$('a[id=termLink]').click()
or any of the other surrounding elements.
I managed to check the check box with $(".CheckBoxStyle").click()
Only issue is still Submit button doesn't get enable. Following is the html code for before and after checking the check box in real situation.
I tried the to click on the submit button with following code. It doesn't give any error. But still doesn't move to next page as expected.May be because of Submit button disable issue.
$("#submitBtnMsg").click()
Edited :
It was turned out above was application related issue. We have to click on the address after selecting via address validation service. Then only Submit button get enable.
$(".RedColor").click()

Collapsible accordion not showing content when initialized collapsed

I'm using twitter bootstrap with JSF-2.2.4 and Spring 3.2.4 Framework. I've built a collapsible accordion based on the following tutorial: http://getbootstrap.com/javascript/#collapse
The code seems to work fine, but only if I start with opened accordions, meaning that I add the 'in' class to the div which inherits the content which is supposed to be collapsed. If I remove the 'in' class the accordion is opened by clicking the appropriate link, but the content is no displayed.
Content is plot created with plotfaces.
Any ideas?
Edit: I just tried filling the box with an image. This seems to work. Maybe this helps narrowing down the problem.
I don't know how this plotfaces work, but i expect your problem similair to fullcalendar not visible until button is clicked or window resized?
Try to set .collapse {display;block; visibilty:hidden;} instead of display none. If this don't helps try to focus on the height of the element. The plugin change the height from 0 to auto but on initial load the height is not set.

IE11 full screen on element

IE 11 has been out just one day as of this posting.
I cannot get an element to go full screen (div or document)
http://msdn.microsoft.com/en-us/library/ie/dn265028
msRequestFullscreen will error 'object does not support this...)
However, the above msdn example will work on passing a target - makeFullScreen(evt.target).
Can I get an div to go fullscreen as in following jquery code?:
var xxx = $('#container');
xxx.msRequestFullscreen();
Or better still: click a button then have a div or the entire document to go fullscreen?
As it stands now, when a click a button, it's the button that goes full screen.
I think this is actually a small misconception of JQuery. JQuery-ing an ID doesn't actually return the element found - it returns a "JQuery object" which allows many actions on that element (or, on a series of elements if you used a class selector)
I don't have IE11 available so I can't test for you, but try this. The [0] should retrieve the element itself.
var xxx = $('#container')[0]; xxx.msRequestFullscreen();
Your code:
var xxx = $('#container');
xxx.msRequestFullscreen();
This is wrong, because you're trying to call a DOM method on a jQuery object.
jQuery calls like $('#container') return jQuery objects. You can do lots of things with these objects, but one thing you can't do is call standard DOM methods. For that, you need an actual DOM object.
jQuery objects contain an array of matching DOM objects, which you can access via [0] for the first one, and [1], etc if there was more than one matching element. So you can do your call by changing your second line as follows:
xxx[0].msRequestFullscreen();
This will call the msRequestFullscreen() on the DOM element rather than the jQuery element, and that should work for you.
In this case, you don't even need jQuery at all, since you're not using any of the jQuery functionality. You could simply use document.getElementById('container') to get the DOM object in the first place rather than the jQuery method. Then you don't need the [0] syntax on the second line because you've already got the DOM object.
Finally, you might want to be careful of course, because this is an IE-specific method; the ms at the front of the name tells you that, which means that your code won't work in other browsers, even if they support the same feature. You need to do it in a cross-browser way. There are some tips on how to do this here: How to make the window full screen with Javascript (stretching all over the screen)

Resources