Ranorex v5.0 doesn’t click button sporadical - ranorex

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.

Related

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

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

which command should I use when I judge string?

I use Automation anywhere today.
I want to know which command should I use.
(I do not know where is manual about command.)
I want to divide the following work with the characters displayed when a certain button is pressed.
For example,
if I press the button A, either yes or no will be displayed on the screen.
If yes displayed, it ok.
but If no, I want to press a different button.
but I don't know which command to judge display.
If you know that, please help me.
Automation anywhere can be used to automate a UI.
If you have a UI which has a button and on pressing that button your UI displays A or B, then you can automate the flow with automation anywhere.
First, you need to use object cloning to clone the button and click on it.
Second, use object cloning again to get value/name property of result and store it into a variable.
Finally, you can put an if-else/if-elseif condition on the variable and enclose your code in the condition accordingly.
You can also find some examples on automation anywhere official documentation website

How to get textfield value in App Inventor without form submission?

I want to know the event in blocks section using which the entered text value can be obtained without a form submission through button.
Let's say user inputs text in mobile phone through keyboard and presses enter. In this case I want some event to trigger and get the value that user entered.
There are 2 events available like lostfocus and gotfocus.
Will these work? Or is there any other good approach for getting text value on pressing enter?
Unfortunately there is no such event like OnEnterPressed available in MIT App Inventor and the events LostFocus and GotFocus will not work in this case.
What you currently can do is
use a button and use the Button.Click event, or
create your own custom keyboard, see also this example
Currently there is a limitation for App Inventor extensions, which only can be used for non-visible components. Later as soon as also visible components are doable, then you could write your own textbox extension and add an event yourself.
Edit concerning the new question in the comments about different screens:
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed...
You can insert a Clock component that monitors the TextBox1.Text. When it triggers, it checks if the TextBox1.Text has changed and saves it to a variable. When it triggers again, it compares the variable with TextBox1.Text. After the user finishes typing, the variable and TextBox1.Text will be equal and then you can trigger the event like you eanted when the user pressed Enter.
Hope this helps!

Forms' focus malfunctioning when both have ribbon

I encountered yet another problem with ribbon. When I have two forms (one of them is main) and I put ribbon on both of them, they behave strangely. When I open the second form by Form2.Show;, every time I click a ribbon menu button on the second form, it loses focus and the main form gets it.
This happens at pure blank project, so what could I possibly be doing wrong?
Here is a video, just in case: Watch YT
And to be clear, the Action1 button has only Caption:='a'; code.
The ribbon control assumes that there is only one per application, and misbehaves if it is not the only control. You could try to modify the Ribbon.pas code, but it is doing some hacks that probably rely on Ribbon.Parent being Application.MainForm only.

In a UIWebView is it possible to determine when the user has clicked somewhere that isn't a link?

I'm displaying HTML content using a UIWebView and would like some action to occur whenever the user clicks anywhere that isn't a link.
I added a UITapGestureRecognizer, however at the point handleTapGesture is called I do not yet know if the user has clicked on a linked or non linked part of the screen.
To work around this within handleTapGesture I added performSelector:#selector(performAction) withObject:self afterDelay:n]
Then if shouldStartLoadWithRequest is subsequently called I set a flag that performAction checks to see if it actually should perform the action or not.
This works perfectly - but only if the time delay n is sufficiently long enough (about 0.3 to 0.4 seconds) which is too long from a users perspective as its a noticable delay. Also I guess the value of n would likely need to vary on different devices with different processor speeds and so its a fragile solution.
Is there an elegant solution?
Do you have control over the HTML? If so, you can add a global click detection, e.g. <body ontouchdown='detectTouch()'> and then use a custom message to your ObjC app, e.g. location.href="touch://whatever". Watch for the link/location change messages in your UIWebView (shouldStartLoadWithRequest) and parse the scheme and data passed. Don't propagate on link clicks. Should work good.
If you don't have control over the HTML, you can always inject your touch handler, but it's trickier as you'll need to figure out the order of events during a link click, and ignore the ones that aren't links.

Resources