Disable user mouse
Hi,
Is it possible to disable the user's mouse events (movement and clicking)? For example, if a user clicks on a button to run some algorithm, I want to prevent the user from using the mouse and enable the mouse when the algorithm is finished.
Thank you. :)
Good idea, but I don't believe that feature exists in Shoes3 so we don't have it and are not planning on it for the 4.0 release, it's a good idea though so I wanna keep it around for a 4.1 release.
You could prevent the user from starting the algorithm again by doing the following:
button 'run' do
if @running
alert 'algorithm is already running!'
else
@running = true
run_algorithm
end
end
def run_algorithm
# algo code
@running = false
end
Thanks, @PragTob . However, in my case, I'm not trying to prevent a user from clicking on the GUI, so your alternative is appreciated, but not helping my case... Clicking on a button on the GUI will make my other stuff to open and run automatically, however, a simple mouse movement may distroy my 'other stuff'. My 'other stuff' cannot be protected by boolean value and warning message, so totally disabling the user mouse will be the best.
Thanks anyway and look forward to see the feature in the later release.
Hm sounds interesting. How does mouse movement interfere with the other stuff? Maybe we can find a solution as I don't think this will land any time soon... plus I dunno what we can do at all. Disabling the user's mouse as a whole should not be possible (they still may want to work with their PC after all). Maybe disabling any mouse events for the app is possible but I dunno :)
Hi again,
As I asked in some previous questions, I'm building a GUI using Shoes 4 for my Watir testing stuff. So, my user can use the GUI to control what they want to test. It's working OK now - one can click on a button, then the corresponding script will read other parameters from the GUI (entered by the user) and run Watir testing code. While running Watir, a browser will be created and Webdriver will be clicking on the links. However, on some webpages (I cannot modify the source code), a user needs to click on a p tag (not hover), then the user can see a div and click on a link in the div. The div will dock/disappear if the mouse cursor moves away or click on somewhere else - if which happens, the following tests will fail since the link is not visible/clickable.
I need Watir to click on the p tag, show the div, and then click on the link in that div. However, the following situations can cause the test to fail:
- The user move the mouse somewhere else after Watir clicks on the p tag and the div shows but before Watir is able to click on the link.
- The user doesn't move the mouse, but the cursor lands on a bad position before the testing start. Let's say that Watir clicks on the p tag and the div shows. The cursor hovers on another link on the page by coincidence. Before Watir is able to click on the link, the webpage thinks the cursor hovers a link, so it failed to focus on the div and the div disappears. Then Watir is not able to click on the link.
Both bad situations happened in real time and can be replicated. So, I want to disable the use's mouse before running test cases and enable it when the testing is done.
I found this http://stackoverflow.com/questions/23218694/disable-hardware-inputs-on-selenium-webdriver-firefox which looks helpful, but it means that my user will need to install more things and get more settings configured. Also, it doesn't look friendly for OSX users.
Thank you. :)
Well, just tried http://watirmelon.com/tag/headless/
I cannot see how the test was going while using phantomjs - which is fine. However, same old problem, the program crashed when executing clicking the link in the div that will show if one clicks on the p tag.