I have an ember.js application. It shows a list of "Problems". Once loaded, the first action taken to select (click) an individual item from this list has a 1-2 second delay. No delay is ever present on subsequent clicks.
The delay is not from the server, if I remove all content from the view/template, the delay is still present.
The delay is not in rendering. If I instrument the rendering process (as described in this answer: https://stackoverflow.com/a/15129150/1167846) nothing happens with rendering at all during that time, and the list displayed at the end shows nothing that indicates a multi-second pause.
If I use console.log all over the place, the click event appears to make all the necessary changes in my code (selecting the item as "current") without any delay.
How do I figure out where this delay is coming from?
Related
I am using Python 2.7, Robot Framework and Selenium2Library on a windows server.
On a page with a button and a data text box, I have a selenium test that clicks the button, this fires off a get request and on return recreates the data text box and updates with the new value. The test then sleeps for 10s to allow this to happen and then reads the value in the data text box.
What I would really like to do is get the element for the data text box, then click the button and keep polling for the original data text reference to become unavailable on the DOM i.e. it has been recreated, and then read the text box to get the value.
I can't for the life of me find out how I would do that using Robot Framework and Selenium2Library as all the calls are self contained and don't pass references back.
Could you offer any other solution?
There are a number of ways to do it with the SeleniumLibrary, all revolving around its Wait Until keywords - documentation link.
Option one - the element is the same, so its locator doesn't change; the check is done with Wait Until Element Contains, and passing the new text:
Click Element ${the_locator_for_the_button}
Wait Until Element Contains ${the_locator_for_the_element} your target text
Option two - if on click the target element changes to a different one, e.g. the locator is different. Then you'd first wait for the initial element to disappear, and the new one to appear:
Click Element ${the_locator_for_the_button}
Wait Until Element Is Not Visible ${the_locator_for_the_initial_element}
Wait Until Element Is Visible ${the_locator_for_the_new_element}
Option three - if you don't want to deal with locators, but to make sure the actual element as Selenium sees it disappears, you can get it with Get Webelement, and then pass that reference to the Wait ... keywords - most (if not all) SeleniumLibrary support both locators or acutal webelements:
Click Element ${the_locator_for_the_button}
${webelement}= Get Webelement ${the_locator_for_the_initial_element}
Wait Until Element Is Not Visible ${webelement}
The good thing about the Wait Until ... keywords is that they constantly poll the DOM for the expected change, and continue at the first detection the condition is met. E.g. it's not a hardcoded sleep that'll pause the execution for the predefined time, but finish as soon as ready.
Have also in mind all these keywords support the argument timeout=Xs, where the X is the time up to which the keyword waits for the condition to be met.
I use GetLastInputInfo() to get the LASTINPUTINFO and check for idleness. This is used for client timeout in my program. Halfway through the set duration for timeout, a dialog will be displayed with a countdown.
It worked properly until now but recently, the timeout either doesn't happen or takes longer because once the dialog is displayed, 1-2 seconds in I will get a new event from GetLastInputInfo() and the timer will reset.
I've tried this multiple times and made sure I touched nothing but it still happens. Maybe it's worth noting, it only happens in some environments. In one computer there is never a problem and it proceeds to timeout properly. But in another, it will occur 100%.
I tried adding a GetMessage() check and found that a WM_MOUSEMOVE message is received at the time the timer is reset. I didn't move the mouse, though. I did find information that WM_MOUSEMOVE messages may be sent multiple times even if the mouse is not moving and that's why the position should be checked with the previous position. Is this somehow related to why I get a LASTINPUTINFO? For 30 seconds I do nothing and suddenly, a random WM_MOUSEMOVE appears.
It happens almost immediately after the countdown dialog is displayed so, by any chance, is a WM_MOUSEMOVE message sent when a dialog is displayed? If so, why did this not happen before? Was it just luck on the timing?
Are there other possible causes as to why I get new input events even if I am nowhere near the mouse/keyboard/computer in general?
How to use the given method in swift 3.
func addAndSetupAccessories(completionHandler completion: (Error?) -> Void)
I observed, the completion handler got invoked immediately although the HomeKit set up page(very initial page of Homekit accessory pairing in iOS 10) was front and the accessory pairing process was not over. If this is the case, how to invoke any operation after the set up process gets completed? How to get if the set up process is over??
The only way to handle it is to assign a HMHomeDelegate to the target HMHome object before calling addAndSetupAccessories and keep track of accessories that are added. The dialog only allows setting up one accessory at a time, so you will get at most one non-bridged accessory and potentially zero or more bridged accessories.
When your view controller that is hosting the process gets viewDidAppear called the second time, check if you have set up a non-bridged accessory. If not, it was either cancelled, or finished with an error, which Apple's dialog would have already handled.
Note that this will not work on iPad as it shows a popup, so viewDidAppear won't be called when pairing dialog is dismissed. I'm not sure it's possible at all to find out when the process finishes on iPad.
UPDATE
iOS 10.3 completely changes this behaviour, and the completion handler of addAndSetupAccessories is now invoked when the pairing dialog is closed (as it should have been to begin with). If nothing was paired, the callback will get an error with code 23, HMError.operationCancelled.
You still have to keep track of added accessories via HMHomeDelegate callback, but post-setup handling should move from viewWillAppear to the addAndSetupAccessories callback.
To the surprise of no one it's not documented or mentioned anywhere in any release notes.
I have an app with a menu. When Item 1 is Selected, UserControl1 is displayed.
The issue is that UserControl1 is full of 3rd party components and takes about 4 seconds to load. I would like to display a BusyIndicator so the user doesn't think that nothing is happening.
The issue is that even though I have a toolkit: BusyIndicator and set it to busy, it doesn't show until after UserControl1 loads. This of course defeats the purpose of the BusyIndicator.
Since the load of the control is on the UI thread, the BusyIndicator never has a chance to fire up until it is too late.
I need to somehow fire off the BusyIndicator, let the UI update, then fire off the load of the Control. Then turn off the BI.
This was resolved by the use of a timer.
Titanium SDK version: 1.7.0.RC1
iPhone SDK version: 4.2
I am developing an iOS app in Appcelerator. I am retrieving tweets from twitter and inserting them into a table. For each row/tweet I am also extracting the containing links for that individual tweet/row and the user can select them from an options dialog which is opened when the row is clicked.
The problem is that if I reload the page and click the row, two dialogs are open upon each other. If I click three times, three dialogs is opened and so on. How can I make sure that the dialog only opens once?
This is my code: http://pastie.org/2004091
Thankful for all help!
I had a similar problem. Especially on the iPhone 3G as this runs slowly and you're more tempted to tap things more than once. The way I got around it is to either remove the event listener from within the event listener itself. Or you set a variable and test for its value in the event listener. So, if you set a variable call 'clicked' to false. When the listener is first check for 'clicked' = false, if it is set it to true so next time the code is not executed.