is it possible to make Selenium IDE wait random amount of time?
Basically I need somehow simulate the human behavior, so it's not that obvious for the website (obviously it is suspicious if something clicks in precise time intervals on various links, right?).
So I have set of rules which goes link after link, confirms by clicking on various links and all I need is to make random pauses between individual clicks. Is it doable in Selenium IDE, or is there some kind of workaround using Javascript + Selenium IDE?
Thank you!
Related
When Im debugging my app in VS2012 and it crashes, the input (mouse and keyboard) starts to lag extremely, the fps drops to about 0.3 or less and I can't even move my mouse without waiting 3 seconds... The only solution is to do Shift-F5 which will end the debugging, and everythng is fine then again.
Whats more interesting, the only lagging thing is the input, the whole background works perfectly fine, text caret is blinking at normal rate and tooltips are nicely animated when mouse gets over a button.
Im compiling the project with allegro 4.2 (I have to use it, it would take too long to explain why).
I have no extensions, a pretty fast pc which should be able to handle debugging...
Im interested in any solution, it may be dirty/hackish... I can of course provide more information if needed.
Thanks for any help.
EDIT: Reading through forums I found some information about the "Auto" window or something like that (don't remember exactly and can't find it anymore), which is doing some "background tasks" and that causes lags... Do you think running it on separate core would fix that?
A tale of multi-second stalls when hitting a breakpoint, related to the raw input API: http://the-witness.net/news/2012/12/finding-and-fixing-a-five-second-stall/ (archived)
It's a very long time since I last saw this sort of thing myself, but I seem to remember that the culprit in my case was DirectInput. (This makes some sense, given the tale above, as DirectInput has long been a wrapper over the raw input API.) And I think the solution was to use the emulated keyboard and mouse devices rather than the default ones, which you do this by passing in one of the emulated device GUIDs to IDirectInput8_CreateDevice. Discussed briefly here: http://msdn.microsoft.com/en-us/library/windows/desktop/ee416845%28v=vs.85%29.aspx
(I don't remember whether cooperative and exclusivity levels made a difference - it might be worth trying changing these too.)
I recently experienced the following similar issues while debugging a game:
Hit a breakpoint, halting the program for debugging.
Pressing any key now takes around 1 second to "process". It will be buffered and sent slowly one after another to whatever window is now active.
In my case, the application installed a low level keyboard hook with SetWindowsHookEx(WH_KEYBOARD_LL, ...). After removing this (for !NDEBUG builds only as you wish), the input lag was gone.
I suppose the hook cannot respond at all while your application is halted, and eventually the system skips it after a timeout, which length can be configured in milliseconds under HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout:DWORD as mentioned here. In fact, the link in the accepted answer mentions this issue, but I thought I explain the core of it right here, also because the link went dead before I fixed it.
Try to find such a hook in your application or dependencies, and check if removing it helps. Since you mentioned this happens to your mouse too, check for a (low level) mouse hook (WH_MOUSE_LL) aswell. The available hooks are listed on MSDN.
Basically, I'm programming a testing application for multiple sites using Watir. However, there are end-users (who can be assumed to be the typical user unfamiliar with the command line, using Windows). Now, I want to give them something to watch, say, what's going on visually (at the clients request, sigh).
I'll be making a GUI, that displays the form data being used to test (random info for forms, username, names, etc) the site and what's going on. I want a preview window, like the WebBrowser class in C#.NET.
Is there a concise way to restrict/encapsulate (idk what other phrase to use) a browser instance in a GUI (wxRuby, Shoes, etc.) w/ Watir (or Watir-WebDriver) in Ruby?
(Note: This is to be run on a Windows machine)
This is a bit of a tall order. Watir itself is just running from the command line, so you'd need to see if there is a way to do what you want with a command line window in the OS you are using. But then watir invokes an instance of the browser (which with Watir-webdriver can be a large number of different browsers), and each of those is their own beast, reacting with the OS and UI in their own way, and I've no idea who you might 'wrap' IE or Chrome or Firefox in the way you are describing..
It MAY be easier from that perspective to see if there would be a way to wrap the interface of a virtual machine perhaps? (maybe some way to do this with virtualbox or vmware?)
This seems like a pretty quirky request if you ask me, I'm having a hard time seeing the business value in what you are being asked to do.
If you're using watir-classic, you can hide your IE window with:
ie = Watir::Browser.new
ie.visible = false
That might be helpful if your requirement is to hide the browser window and only display a console window for logs/status messages.
If you're using Watir WebDriver/Selenium, I'm not sure if a similar method is available. In a quick search I didn't see anything.
The IWebBrowser2 "visible" property may be useful - not sure how hard it would be to patch this in to Watir WebDriver if it doesn't already support it:
http://msdn.microsoft.com/en-us/library/aa752082(v=vs.85).aspx
I'm writing WPF application
application targets all sort of windows and low performance computers
so I want to write launcher/splash screen for it which will be displayed before application loads
I'm not sure what language to use or what technology
I want it to be very fast and lightweight
can you suggest anything ?
Displaying a flash screen is as easy as popping up a dialog. If the dialog has the various resources such as bit maps already included then it is quite fast. However one issue that will determine this speed is how much other stuff is being initialized at application startup before the code is hit to display the dialog.
So one option would be to have a very simple application that does nothing more than display the flash screen and then start up the actual application. A simple Windows dialog application would do that. You would need to figure out how to synchronize the actual application finishing its initialization and the launching application stopping if you choose this route. There are several techniques for this and the most likely would be to use an interprocess mutex or perhaps just look for a file to be created.
For a point of sale I work with that is launched as part of turning on the terminal we ran into problems in which the application would start before some required system services such as database manager were up and running.
We have found that some environments require much more time than others so a registry variable makes it easy to tweak the delay in the field.
So as part of the application initialization what we did was that when the application starts up, it displays a dialog with a progress bar. The progress bar does a count up and we have a loop that does a one second sleep then increments the progress bar.
The number of seconds to wait is a registry setting for the application with a default value.
One problem we ran into was that when doing development and testing in a debugger, the default value was way too long for impatient programmers wanting to get started so we have condition compile so that if it is a debug compile, the delay is set to a couple of seconds. Otherwise the default is 10 seconds. However it can be changed with a change in the registry value.
See also this Stackoverflow about a launcher.
If you want something realy fast and lightweight, C would be nice.
If you dont want to learn C, you can also make a console application with .NET and C# it's fast too
Edit for comment: You can use a library like SDL wich is very fast and powerfull, and can draw images from a console application.
I'm writing an extension that opens a tab when Chrome first runs, technically means placing code in the background page, which sounds simple enough, and works fine in Windows, and probably Linux as well, though I haven't tested it.
The problem is with Mac, which doesn't actually fully close Chrome when the user clicks the close button at the top left. To fully close Chrome you have to force quit it, which is something people generally do not do.
So this means I'll need to rely on some other event to trigger code when the user first "opens" chrome. Does anyone have idea for which even that could be? I suppose I could add a listener to every tab's create event and check the number of tabs, or something similar, but I'm looking for a light weight solution. Any ideas?
UPDATE: One idea us to use the chrome.windows.onCreated event and just check that there are no other windows open. Is that the best method, or can anyone think of something more efficient?
Use two events and a counter. Because window open/close are relatively rare, this should not be a problem:
onCreated, increase the counter, and validate the value.
onRemoved, decrease the counter.
I am using autoit to handle javas script popup code as
autoit.WinWaitActive("[Class:#32770]")
result =autoit.ControlClick("[Class:#32770]","","Button1")
But when I click on the button to open the popup it waits for a longer time & if the user is performing operations on another window, it will no go further. Only when the user clicks on the current window does it work. Means user should be focused on IE browser at the time of javascript popup.
Most tools that work up at the OS UI level (as autoit does) require that the window to be worked on has focus in order to have things like clicks or keyboard input end up in the correct window.
You'll probably want to set the focus first, then try to click, if you are using autoit
There are other methods for dealing with JS popups, especially with more current versions (1.9.0 or above) of watir, which are more elegant. Refer to the Javascript Popups page in the Watir Wiki
Do be aware that most of the solutions you see presume that the browser will have focus. If you need to run scripts at the same time as doing other work and don't want what you are doing to interfere, I might recommend using a virtual machine to run the scripts