05.25.07

Watir Has A New Method: after?

Posted in Watir at 2:35 pm by Željko Filipin

Imagine that you have two links. Both links are the same.

The only thing that makes them different is that the second one is located after an image.

Of course, you just have to click the second link. You have already tried this.

But, it always clicks the first link. There is a way.

This is so cool.

(You will need Watir 1.5. Bret Pettichord posted that at wtr-general.)

05.18.07

New Watir User Guide (Beta)

Posted in Watir at 10:01 am by Željko Filipin

Don’t you just love all those betas? There is another one! New Watir User Guide (Beta). Check it out and let me know what you think about it. It is just a first draft. Please, be polite. It is just a baby.

05.15.07

XPath String Functions

Posted in Ruby at 11:03 am by Željko Filipin

I have XML that looks like this.

I need to get value of hash attribute (BF8E8F60E722E92C7ED8303916591AB4). I know the value of m url parameter (inside url attribute) (7fb83717-9606-4022-bd4e-67b6f6582ada), but I do not know the value of code url parameter.

I know how to get attribute of a tag when I know another attribute of that tag. For example, if I knew hash attribute and needed url attribute, I would do it like this:

But, I know only part of url attribute. Of course, this does not work (because e[...] returns nil).

I have heard that there are XPath string functions, but I did not understand how to use them, or would it even help in this case.

I have solved this problem with regular expressions, but I guess there must be XPath solution.

Also, I have already asked my developer to simplify that XML, so I can use it, but that has low priority because I have already solved the problem.

Angrez Singh was kind enough to help me. This is the solution.

You can find this thread at wtr-general.

05.09.07

Updating Watir User Guide (2)

Posted in Watir at 11:51 am by Željko Filipin

(From wtr-general.)

I have been thinking a lot about updating Watir user guide these days, but I did not have time to start working. I will have some time next week (if not before). I think if user guide is migrated to Watir Wiki it would make contributions much easier, so I plan to do that. If anybody would like to start working on user guide before I migrate it to Wiki, go ahead and grab it from Watir SVN repository, make Wiki page and start working. If you do not know how to get it from SVN repository or how to create Wiki page, please let me know.

I received a lot of good advice about updating user guide. There is a clear need for more documentation on Watir. I do not think that everything should be in user guide. My plan is to make user guide as short as possible and provide links to more advanced topics. Something like:

  • Install Ruby.
  • Install Watir.
  • Open IE.
  • Navigate to a page.
  • Click a link.
  • Click a button.
  • Verify some text is there.
  • That was easy!
  • Want to learn more?
  • See how you can work with:
    • Other tags.
    • Various pop-up windows.
    • JavaScript.
    • AJAX.
    • Unit tests (running them, reading them, learning from them).
  • There is also lots of good documentation on Watir that is at our site. See:
    • FAQ
    • What is Ruby?
    • What is Watir?
    • Is there a difference?
    • Why should I care?
  • There is also lots of good documentation on Watir that is not at our site. Check it out:
    • Articles.
    • Cheat sheets.
    • Books.
  • Have question? We have mailing list! When posting a question make sure that you include:
    • Relevant snippet of your Watir code.
    • Relevant snippet your HTML.
    • Error message that Ruby gave you (if any).
    • See example question.

I think this short tips about posting to mailing list are very important. I just hope people will read it.

I think we are ready for several Watir tutorials (at least two).

Take Ruby for example. It has Pickaxe book that you can have on your desk and not be embarrassed when you boss takes a look at it. There is also Why’s (Poignant) Guide to Ruby. I remember how my boss was surprised when he saw Why’s book. I am sure he thought I was joking when I told him that it is a book about programming. (Hint: cartoon foxes shouting “Chunky bacon!”.)

Watir user guide can have “enterprise look”, but I would also like to create one version with cartoon characters. I am sure there are lots of creative people here and I hope they will show their creativity. If you would not like to see cartoon characters in Watir user guide, please do let me know, I will not put it at Watir Wiki. (I will put it at my blog and smile to my jokes. Alone.)

05.07.07

How Much Time Do You Spend Learning?

Posted in Self Education at 1:22 pm by Željko Filipin

Some time ago, I used to work all the time. I just did not have time to learn anything new. Then I read a few articles and learned a lot. I saw that I just have to learn more. Then I used to learn so much that I did not have time to work.

No I try to limit my learning to one hour per (working) day. I think it is optimal. For now. Sometimes more. Sometimes less. I read books, blogs, mailing lists. Sometimes I write a post here or at some mailing list. I test. Manually. I write Ruby (mostly Watir) code to help me test. Very useful for regression tests. I have several pet projects that help me spend my free time. Sometimes I build a small application. Or learn basics of new programming language. I listen to podcasts. I think it all helps me learn something new.

I was just wondering how much time do you spend learning. What is your favorite way of learning? Have you ever learned something and felt like your eyes have just been opened? Have you ever dreamed code? Have you ever reproduced a bug in your dream?

05.05.07

Updating Watir User Guide

Posted in Watir at 8:28 pm by Željko Filipin

Bret Pettichord has posted The Plan for Watir at wtr-general. If you are interested in future of Watir, you should read it. This is from that post.

Jeff Fry is threatening to help out with the Rdoc and Zeljko has agreed to take the lead with updating the users guide. Please cooperate with any requests that they make.

I need help. I will not request it. I am kindly asking you to help me. At Community involvement with Watir thread at wtr-general Bret asked how the Watir community can help me. The following is my (slightly edited) response.

Last night I had a dream how I bribed cartoon foxes from why’s (poignant) guide to ruby to switch to Watir user guide. :) (Bret encouraged me to be “bold”.)

How can you help?

The usual.
Suggestions. What to add, what to remove, what to change.
Comments on my changes. They will be bold.
Bacon. Those foxes demanded lots of bacon.

05.03.07

How much space does Windows CD take

Posted in Bugs at 11:07 am by Željko Filipin

I inserted my Windows CD in CD drive, right-clicked it and selected Properties from context menu. It said: “Used space: 573 MB”. Then I selected all files and folders at that drive, right-clicked and selected Properties. It said “Size: 815 MB”. Strange. CD has maximum capacity of 700 MB, right?

cd.PNG

files.PNG