How to make the selenium web driver click on a button which is inside react spotlight (React Joyride)? - ruby-on-rails

I've added a controlled tour in my app using ReactJoyride. At a particular step, the tour will progress only when the 'Ongoing' tab/button is clicked (see image).
This 'Ongoing' button is inside the spotlight.
I've tested this manually and it works perfectly. However, while testing this using Selenium, I can't seem to find a way to click on this button.
I'm getting the following error :
It says that react-joyride__overlay will receive the clicks. But react-joyride__spotlight is a child element of react-joyride__overlay and i've enabled spotlightClicks.
The current code that i'm using is this : (test.rb)
the commented lines of code are the other ways that i've tested. All of them failed.
If you can point me in the correct direction, I would really appreciate it!

The problem here is, your desired element is overlay-ed by other element, so this other element is hiding your element. All you have to do is, you have check whether this overlay is permanent or temporary. If it's temporary, you have to write the code to wait until the other element gets disappeared, If it's permanent, then you have to issue the click on top of the other element so that your desired element would receive the click.
Let me assume your overlay is permanent so try this code
find(xpath: "//div[#class='react-joyride__overlay']").click

Related

Automatic hover triggered on element with FastClick like implementation on iOS 8.1

I have created a simple FastClick implementation. Issue I will be describing occurs with FastClick but since it seems more like a browser bug, i decided to create non-FastClick version to represent the issue.
https://jsbin.com/fofaxiniya/1
Test this on iOS device or simulator running iOS 8.1 or up.
Scenario:
at least iOS 8.1 or up
A simple page with two buttons with active and hover states.
touchend handler that creates a synthetic click event and disables the original click event.
Steps to reproduce:
On the device or simulator,
Click on the first button
Click on the second button that removes itself from DOM on click
The hover state of first button gets triggered.
Why is this annoying?
Because of this weird behaviour, combination of FastClick and Single page application leads to some button randomly being hovered on navigation. Which is definitely unwanted behavior.
I am already considering removing all the hover styles from touch devices. But if I could actually target the problem itself, which is getting rid of the random hover from happenning, that would be great.
Any attempt to shed some light on this will be highly appreciated. :)

Polymer.Dart's floating label for PaperInput not visible

I have the example code in my Angular.Dart component:
<paper-input bind-value="value" label="MyLabel" floatingLabel></paper-input>
The paper input shows the value that is in my Angular.Dart component, but the floatingLabel does not appear. However, upon clicking the input, the label appears with the standard animation as if it was hidden. It seems as though this is a bug with the "constructor" of the paper-input element. I expected the floating label to appear above the input field when text is in the input field regardless if it was newly created or not. Is there a way to fix this glitch?
Progress: (github.com/Polymer/paper-input/issues/117)
I am looking intensively at the issue listed above, however implementing the fix accordingly is not as easy. As suggested by #GünterZöchbauer, I can use the dart:js library. However it appears that the solution was designed specifically for PolymerJs and not particularly for PolymerDart. Maybe I am overthinking things, but I am unable to perform a simple port.
But the issue does bring up a good point. The element is unable to detect the change (for what ever reason). So something needs to poke it to trigger an update. I currently have the dart context to the Element, however the class (paper-input is the class) does not contain the method inputAction upon inspection with WebStorm. However assuming that the inputAction method was firing an event, I can simply use the dispatchEvent method. However which event will trigger the event without modifying the object itself? And not crashing the browser would be great (I have been crashing the webpage with Chrome's Aw, snap! blue screen of death with some event tests).

The infamous "sticky" :hover on iPad - how does Google fix it?

I have unfortunately stumbled on the issue where, on iPad, a pop-up menu summoned by way of :hover does not disappear from the screen when the user touches an empty area of the page.
The problem is the same described here:
Hover Behavior on Desktop vs iPad
The menu is part of a template I bought, namely:
http://html.realia.byaviators.com/
But... wait a minute... it WORKS on the template's home page? And only on that page -- it doesn't work on any other page of that same template.
I was able to track the behavior down to the point where I found that the reason why it works is the following: initializing a Google map makes the menu behave properly. Just the simplest of maps, with the default options.
Now my question to the experts is: what is that Google does in the map initialization code in order to fix the :hover behavior?
Thank you very much in advance for your help!
Well, can't tell what is that Google does, however the solution is documented in mobile Safari developer's reference.
For a click event to be generated on an area of the document, there must be a click handler attached. For example, clicking on a div will generate a click event only if an onclick="void(0)" handle is presente:
Clicking here triggers event in mobile Safari

Ranorex v5.0 doesn’t click button sporadical

I have a ranorex project, which automated an use case with clicking 5 buttons in an application.
To set up this project I used the record function. I defined some sleep times between the clicks.
The run with the clicks is in a loop, where the loop count is dynamically defined. One button of the five and always the same button, Ranorex "ignores" sometimes. According to the log file, the button is visible and enabled and ranorex also runs the code with the Click(), but the application doesn’t receive the click. Before in code the click is called, I check with an “If” whether the button is visible and enabled - and if the click() is called (or doesn't), I log it to ranorexlog. Sometimes the application is running through and all the clicks work and sometimes this button click is missing one or more times. It doesn’t depend on the sleep time between the clicks, because I tried long and small pause times. It doesn’t depend on the focus of the application, too, because I switched the focus several times.
Does anybody know this problem, workarounds or what I’m doing wrong?
the obvious workaround is to use Mouse.Click("{Button}") with a 0 duration rather than invoking the click event, or if you are invoking the mouse click invoke the buttons click action. (sorry since they are both named Click() i don't know which one you are using).
As to what is happening, from your description it sounds like your script is finding more than one element with the same xpath. This would cause issues with the click event because it may try to click on the element, but it's the first xpath that matches not the second. Are there any optional elements in this sequence of button clicks that appear? for instance a busy spinner with inner text of "OK" that is hidden from view when you are clicking a button on a form with inner text of "OK" would cause two elements to be found if the xpath was looking for an inner text of ok. This element that is causing may not have been caught in the recorder because it might not have been present at the time.
Another possibility if you are using Mouse.Click() (particularly if this is a website)is that it is possible your button is not actually on the screen, I know that should be taken care of by the visible check but it is visible on the dom even though it is not visible on the screen that causes issues.
I highly recommend do not use the recorder to create test suites that need to be re-runnable. It would actually be better to use the spy tool to create a repository or several repositories for the product you are testing, this way you can be sure the xpaths are all unique, which using the recorder there is no gaurantee. You can actually record with the created repository, and ranorex will attempt to find item in the repository before creating a new item, so the recorder will use this repository when creating recordings.

PhpStorm 6.0.1 - Shortcut to save activates search bar

So i got the following problem. When I'm working inside the editor and press STRG + S (what should be save) the document gets saved, but what happens also is, that a search bar gets popped up and the next thing I write get's written into the search bar instead of the editor itself. I then have to click into the editor again to write there. This is pretty annoying since I save quite a lot. In the Keymapping STRG+S is set for Save all, so this doesn't make really sense for me.
As a comparison here two screenshots. The first one shows how it looks like, when I write something and didn't save yet. The second one shows what happens, as soon as I press STRG+S
As you can see a search bar pops up and gets the focus of the cursor. This is what I'm trying to solve but can't find a solution for.
Update to the latest version, 6.02, your problem should be solved.

Resources