Terminat or Stop HtmlUnit - htmlunit

I use htmlunit to test some website and I noticed that Htmlunit got stuck on some webpages. This problem is making the thread within which htmlunit was call from not terminating. Please do you know of any way to stop Htmlunit like in a real web browser where you will just click the browsers stop button. I want to stop/terminate Htmlunit when it is stuck/hangs while accessing a webpage.
Thank you.

This should do it
webClient.closeAllWindows();

Related

Watir Selenium see if ajax request made

Is there any way in Watir to check if a ajax call is made?
I mean when testing manually the tester would open Firebug or an equivalent program and check under the network tab and see that the request appears there.
How could this be automated using Watir?

HTML/Javascript login page using CasperJS

I've been trying to login to write a script using CasperJS that logs in to my work's router login page, and I'm a little lost...
The html for the login page is here: https://dl.dropboxusercontent.com/u/30314127/help.rtf
Thanks in advance,
Ronka
I'm not sure anybody is going to write the code you need. Casperjs has pretty good documentation. You need to request the page, find the id's of the login and sendKeys. I haven't run into any issues of not being able to log into a web based application using casper. IF you're completely at a loss I have a video you can watch which enters data into an Ajax application, which shouldn't be too much different than what you're trying to do.
Filling out Ajax forms

Run Capybara without opening browser

I wrote simple console script for scraping with capybara (selenium driver) but doesn't want browser to appear. I just wan't text to be written on console.
Is possible to run capybara wihout opening browser?
There is a headless-webkit driver for Capybara that would avoid opening a browser window.
If you are not tied to the Capybara API and don't need to worry about JavaScript then mechanize would probably be a simpler way to interact with Web sites.

Testing an iframe with Selenium puts the iframe into infinite loading while manual check for the same iframe goes fine

I am testing an iframe within a page. When I run my ruby script with selenium-rc, the page loads up fine but the iframe goes into an infinite loading causing my script to time-out. Though on manually checking the same script, we get the expected result.
Any idea if selenium does something with the browser settings?? I have tried it with FF and IE, both.
what do you mean by infinite loop? Also are you having selenium interact with the IFrame, or just visit a page with an iframe on it? One idea would be to create a super simple html page, and put an iframe to google.com in it, and see if this problem still persists.

Executing AJAX scripts within an AJAX response

I'm having trouble using AJAX page updates along with other AJAX scripts.
During a normal page load, the AJAX scripts (picture scrolling and picture thumbnails) work fine. But when I update a page with AJAX, these scripts (usually loaded in the header of the initial page load) stop working.
I am wondering if this is specific to these scripts and I need to look into them deeper to resolve/re-write or if I am missing something more generic in combining AJAX page updates with AJAX scripts the returned code relies on.
Embedded javascript runs fine.
Thanks for your ideas!
PS: The scripts I am using are from www.dynamicdrive.com are:
1) stepcarousel (http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm) and
23) thumbnailviewer (http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm) from the
Try doing this on Firefox, using the Firebug debugger, so you can single-step through and determine what is going on with the javascript. If you are using IE8 then you can hit F12 and bring up the debugger for that environment also.
Once you have some idea what is going on then you can explain what you are seeing, what browsers you have tried and you will get more help.

Resources