Accessing multiple scroll bars using selenium - iframe

How to perform actions on the scroll bar present in an iFrame?
Issue 1:
I need to click on the link present in an iFrame which is displayed on scrolling the vertical bar. But when I try to click the link Selenium 2.0 is unable to find the element and it is scrolling the web page scroll bar.
Thanks in advance.

I think the best way to solve it is making your link visible through javascript (Changing the hidden property to visible).
Anyway, did you try sending a spacebar press using sendKeys? It will scroll down if you are already on the iframe

I used this to click the element - without seeing it (also in iframe). When I tried scrolling, or element.click(), the iframe scrollbar broke and test was unable to continue.
If you cannot find it like this, try using js to find it aswell.
WebElement element = getWebDriver().findElement(By.id("element_id"))
JavascriptExecutor jse = (JavascriptExecutor) getWebDriver();
jse.executeScript("arguments[0].click();", element);

Related

iframe, allowing clicking but disable scrolling

This is a duplicate question of Disable all scrolling in an iframe, but allow clicking but I'm going to risk asking it again because that question was asked in 2014 and no solution was found (except that it can't be done). I'm desperately trying to find out if this can be done now. Therefore I would like to post this question again:
I'm trying to disable all forms of scrolling in my iframe, but still allow the user to click a button that appears in the iframe. I've successfully disabled all forms of scrolling (scroll bars, mouse wheel, etc) by using scrolling="no" and style="pointer-events: none;", however the later disables all forms of clicking to. Is it possible to prevent all forms of scrolling while still allowing the use to click within the iframe to inter-act with a button?
Unfortunately I don't have control over the iframe's content.
Possibly there is a way how to do this now after so many years? If so, I'd be very happy to hear about it. I checked all kinds of similar question of clicking and scrolling iframes but I did not find a solution yet.
Hmm... Honestly, I've never tried that.
But I imagine you could put a div over the suface of the iframe (as if it was a transparent overlay), and then when the user clicks the invisible div (that is on the iframe) then triggering a click event on the iframe?
If you happen to need the click's coordinates then make sure the div has got the exact same dimensions of the iframe (but with less z-index, so you make sure it's ON it) and then pass the div's click event coords to the iframe's click event you are gonna trigger.
Let me know if this works!
Regards.

How to position ExtLib dialog in XPages not to center parent or screen

I want to position my Extension Lib Dialog control to another than it´s default position, which seems to center to the window or the parent element. I have seen that there is a resize-listener, maybe this could be overwritten.
I tried to position it directly in the style-class, no success:
<xe:dialog id="loginDialog">
<xe:this.style><![CDATA[#{javascript:return "top:100px !important; left:50px !important;";}]]></xe:this.style>
<xp:div>
<xp:label value="Label" id="label1"></xp:label>
</xp:div>
</xe:dialog>
Seems that no one else has this problem ?? I could not find any topics or posts on this.
Are you sure you want a dialog? You might want to check out the ToolTip and Tooltip dialog controls. That's likely what you want instead of trying to mess with the main dialog.
The Ext. Library comes with a sample application. There should be code examples in there. Suggest you take a look at this page once you get it installed : /XPagesExt.nsf/Core_InPlaceDialog.xsp
If you must mess with the dialog itself - search for ways to do this with a standard dojo dialog. Since that's where the XPages one comes from. Maybe start here : How to set the location a Dojo Dialog opens at?

Google VR Reticle Click on UI Button

So I am having this issue with using Google VR reticle where I cannot click a button. I have an image attached showing the heirarchy and the PlayButton is what I am trying to click. The Canvas has a Graphic Raycaster, the button has an Event Trigger that calls the method to navigate to the next scene. The UpScrollPanel, and DownScrollPanel work just fine. The EventSystem has the Gaze Input Module, as well as Event System, and Touch Input Module.
Any ideas on how to get this working? I have watched a few videos from NurFACEGAMES and while they helped a little, I haven't gotten the click to work yet.
Oh, and I am using Unity 5.3.4f
Sometimes things can get in the way of the button, make sure that no other UI elements overlap it, for example text borders (which are actually larger than they appear). You can also fix this by moving the button up the hierarchy among its siblings, I believe the first child is top.
Also try moving the button up the hierarchy if possible, sometimes UI having certain parents makes them not work
The canvas object should have a graphic raycaster
I found the issue to be unrelated to anything I thought it was. The menu I was using is a prefab I also use in another view that isn't VR. The scrollrect was loading that prefab, instead of the modified one I was using in the VR menu, and therefore the triggers I had added to the button were no being used when the app loaded.

Can't click overlapped element within a popup(not main window),how to scroll it to view?

As you can see,I can click the first check box(PRODUCT-323),but can't click the second.After a long
trying,I find it is because the second doesn't get scrolled to view(Is it intented by tool design or a bug?).So how to scroll this popup div to ensure the second get shown?
Actually,I have tried this,but failed
((JavascriptExecutor)driver).executeScript("document.getElementById("pupop").scrollTo(0,30)");
Can you please share which version of WebDriver are you using?
If I remember correctly, Version 2.16 or so had a known issue with locators not scrolling into view. The reason being,, they were using the position co-ordinates of the center of the element to bring focus and in this case, the center is hidden from view. This was solved in later versions.
There are a couple of approaches.
1) Try to perform some action on an Element that is completely hidden from view.This will bring the element fully into view and you will be able to access it.
In this case, try to access the checkbox in 3rd or the 4th row, you will be able to bring focus there. Then access the 2nd row.
2) Do a Driver.Manage().Window.Maximize() [This is in c#]. This will also bring the element into view.
It is a good practice to avoid a window with both scroll-bars. By maximizing it you will reduce the window for such errors.
Hope this is useful.
Did u try the keyboard options?? ctrl+ down arrow through script???
Or in the worst case use tab to focus on to that checkbox.. I works in OpenScript and RFT this way.
1) To click the second checkbox: You can use the xpath to find that element. In xpath you can easily get the table row id for each checkbox which will gets incremented in their ID.
2) To scroll you can use the below code:
JavascriptExecutor js = (JavascriptExecutor) webdriver;
js.executeScript("scroll(0,0);");

Colorbox inside iFrame - Close from parent

I am working on a project where I am simply loading same directory content into an iFrame. No external pages.
I have Colorbox within the iFrame content which is working beautifully.
My question is: I have some "parent" buttons which I would like to make them close any of the iFrame Colorbox popups. The project is an "information point" system with some buttons in the parent that show at all times, but whenever I click the buttons the iFrame Colorbox stays open.
A lot of the pages I have found talk from the opposite way, controlling the parent from within a Colorbox iFrame...
I'm going to guess that this may not be achievable from a security point of view...
many thanks everyone :)
You might be able to do something like this:
$('.cboxIframe')[0].contentWindow().$.colorbox.close();
I ended up using jQuery the other way round so the child controls the parent and hides the parent controls and when the ColorBox control is closed it "shows" the parent controls.

Resources