I want to write code to log onto an Internet account and also click buttons to navigate to do different things such as watch for something to change. for example I would like
log on to account
click to navigate
while(until I say to stop)
watch for changes
You may look at
http://watij.com/
For automated website tests you can use Selenium.
You might not need to write code - if you use FireFox, perhaps try the iMacros addon?
You've not said what language you want to write this in -- for .NET there's http://watin.org/
Related
I searched around and couldn't find how to test a file download box using capybara/cucumber?
The following image asks the question much clearer.
This was similar to another question I just answered, hope it helps Anybody have idea how to test file download using cucumber?
#Millisami Capybara::NotSupportedByDriverError Fixed for me!
What i had to do is removing the #javascript tag from my cucumber test, which was included. I mean:
#search
Scenario: Recieving a file
...
instead of
#search
#javascript
Scenario: Recieving a file
...
Hope it helps :-)
The download box is a function of the browser. Capybara simulates a browser but without all the UI etc.. (e.g. it looks like a browser to your application, so using it you'd mostly skip over the whole file download UI stuff. It would look to the browser like someone did whatever they needed to in order to tell the browser where to put the file and start the download)
If you are trying to test a download box, (beyond clicks needed to start the download) you are now testing the browser, not your application. As yourself if that's part of your charter and worth your time.
To actually test the download box you are going to have to have a browser instance going, and use a tool like Firewatir/Watir or Selenium, to actually 'drive' the browser, and some other gem to actually automate up at the OS UI level (on windows we usually use autoit) in order to click things and fill in values of the browser's file download UI.
I'm working on a vb.net web application and want to make it to where when someone puts in a url into the browser or when someone clicks on a shortcut, a new browser window is opened but there is no back or forward, no refresh, no navigation bar, etc. Does anyone know how to do this or if it's even possible? I just want the browser shell essentially. Thanks.
I would advice against this - the browser is the users domain, don't mess with it. Are there any particular reasons for your choice of functionality?
Any ways to make this possible will be based on Javascript, and this can always be disabled by the user.
You can do this in javascript code behind cannot open new browser windows. Take a look here.
you can do this with javascript using the window.open() method.
In order to automate DOH tests during our build process, I use Selenium RC to launch different browsers (IE and Firefox) on a server placed on a different domain than the build machine. Each browser is directed to our runTests.html in order to start DOH.
Sometimes, when a test that uses doh.robot starts, the following message is shown:
"DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page"
but since these tests are unattended it just sits there waiting for someone to click OK, and Selenium times out (in IE 8 it seems like the pop-up disappears automatically but the robot does nothing afterward).
As I said, it doesn't always happen. After you click OK on the Pop-up, the message will stop showing, and the message can go away for several sessions, but then it will show again in which seems to be an arbitrary way.
Does anyone knows a way to prevent this pop-up from showing?
This is probably not the correct way to do it, but in util/doh/robot/DOHRobot.java, you may be able to modify the code to not check that or always simulate pressing "OK". I haven't tried it myself, but I may also need to do that for some of our automated testing.
When the DOH robot is initialized, it first tries to click in the upper left corner of the page you are trying to test. If you obscure this div (you can see it with firebug), then the message will pop up. I think the problem is that your page isn't always loading up quick enough.
It is somewhat of a challenge to fix this. I haven't used DOH in awhile, but I don't think there is any way you can use a setTimeout to fix this. (You can try using setTimeout on the doh.run command, but it might be the case that the DOH robot clicks that div before parsing any doh commands.)
Another thing you might be able to do is add a sort of "wait" command to Selenium, or whatever shell command you are using to fire up the system.
I have started testing my UI using qUnit, so I need to simulate some user interaction. Is it possible to "simulate" a user clicking a checkbox using javascript ?
Thx guyes. I figured it out about two seconds after I posted the question. It was as you say simpler than I had imagined
document.getElementById('cb1').click();
did the trick
Edit: It seems in IE7 (and perhaps other browsers) the the click method will not actually check the checkbox. So to fully simulate you need to "check" the checkbox before clicking it
document.getElementById('cb1').checked=true
document.getElementById('cb1').click();
You can look at this:
Simulate a buttonclick via javascript
It is the other way arround, so i'm not sure if it works on checkboxes too.
Shell ("explorer.exe www.google.com")
is how I'm currently opening my products ad page after successful install. However I think it would look much nicer if I could do it more like Avira does, or even a popup where there are no address bar links etc. Doing this via an inbrowser link is easy enough
<a href="http://page.com"
onClick="javascript:window.open('http://page.com','windows','width=650,height=350,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'); return false")">Link text</a>
But how would I go about adding this functionality in VB?
If you want it to look professional, you need to use an actual browser component. VB.NET comes with one. If you are using an older version of VB, you'd need to go third party. If you want to stay with a shell open, you would have to individually target the browser command-line and pass arguments to indicate that it should not have toolbars etc.
Speaking as a user, I find castrated popup windows annoying and unproductive.
So my answer is: "don't".